word looked up : home / archive

 Datatype : Type 

In computer science, datatype (often simply called type) is a concept that clarifies contexts for numerical and other operations, limits destructive and useless operations and provides semantic documentation to programming languages. Types are applied both immediate values[?] and variables. They are loosely related to similar notions in mathematics and logic.

Types are usually associated either with values in memory or with objects such as variables[?]. Because any value is simply a set of bits for computers, there is no distinction in hardware even among memory addresses[?], instruction code[?], characters, integers and floating-point numbers. Numerical and string constants and expression in code can and often do imply type in a particular context. For example, an expression 3.14 implies its type is floating-point while [1, 2, 3] implies type is a list of integers; typically an array.

In some languages, such as C and Java, some types are associated with the particular implementation. For example, in Java, type int is defined as a 4-byte signed integer. On the other hands, some languages only define the semantic behavior of all types.

The type system allows operations to be done relying on contexts by type. For example, in an arithmetic expression, a + b, if a and b are typed as integer, an underlying operation can be integer addition. If the type is real, floating-point addition is probably done. In generics the type of values determines which code will be executed.

Types make impossible to code some operations which cannot be valid in certain context. This mechanism effectively catches the majority of common mistakes made by programmers. For example, an expression "Hello, Wikipedia" / 3 is invalid because a string literal cannot be divided by an integer in the usual sense.

Using types in languages also improves documentation of code. For example, the declaration of a variable as being of a specific type documents how the variable is used. In fact, many languages allow programmers to define semantic types derived from builtin types; either composed of elements of one or more builtin types, or simply as aliases for names of builtin types.

While some languages use types during compile-time and don't have them during run-time, type information can be stored in memory for use during run-time. Many OOP languages keep certain information about type at run-time to make possible dynamic binding[?].

Some, particularly script languages and assembly languages provide no type. Object-oriented programming languages mostly support a type system by classes.

The process of verifying types is called type checking[?]. If it occurs at compile-time, the whole type system is called statically typed. If it occurs at run-time, the type system is called dynamically typed. C, Java and Pascal are statically typed while most script languages, including Perl, Ruby and Python, are dynamically typed. One of the primary tasks of semantic analysis is type checking[?]. In dynamic scope, type checking must be done at run-time because variables can be differently typed according to execution path.

If type A is compatible with type B, A is a subtype of B while not always vice versa. See subtype for detail.

Types are generally divided into primitive types[?] (also called built-in types or basic types) and composite types[?]. Typical primitive types[?] include integer and floating-point number. In some programming languages, strings are also a primitive type. Composite types[?], as the name implies, are types consisting of basic types. They are also called a record or structure type.

Datatypes are often of first-class, second-class or third-class value.

Examples


Ainsi mer passerent Or sunt a Romme revenu. Nouveles leur ha/ha.html">ha demandees se/se.html">Se li/li.html">li pelerins voir disoit. <ne/ne.html">ne/ne.html">ne/ne.html">ne dist Que il au/au.html">au prophete feit unt, Pylates si/si.html">si/si.html">si grant tort pas n'a <Ne qui men fil mestier eust?>> Une chose que vous diruns.>> Commen il la femme.html">femme trouverent Tout ainsi cum la chose aloit. Quant l'oi/oi.html">oi, si en fu mout liez; Et vos journees emploie; N'oi paller de sa pareille.>> A la femme et la bienvigna; Qu'il la feroit et pleinne et drue, A son fil et joie et sante. En son cuer mout s'en esjoi Sui toute preste d'acomplir.>> Qu'avec li avoit aportee. Et durement se merveilla, Que meis teu semblance ne vist N'y avoit or, argent ne fust. Et en la chambre la porta Pour sa maladie enfermez; Si que Vaspasiens la vist; N'avoit unques la char eue Car Nostre-Seigneur ainsi pleut. Qu'est.html">est-ce qui si m'a alegie De mes doleurs? ne les sent mie.html">mie.>> Vaspasiens s'est escriez: Si firent-il hysnelement, Quant eurent le mur depecie, Ore unt bien la nouvele enquise Ki ainsi tost gari l'avoit, Et il li unt trestout conte Il unt le pelerin hors mis Se c'estoit voirs que dist avoit Qu'il aient si preudomme ocis; Au pelerin unt tant donne Et Verrine pas n'oublierent, Sachiez que ce ne li plut mie, Et dist: <

 On wordlookup.net  

All is still licensed under the GNU FDL.
It uses material from the wikipedia.



logo

navig stuff

home
archive