Sfairadora

  • Reference Guide

Concept of Data Type

Every data item may acquire values from a certain domain corresponding to a particular property of the object being represented. For example, the domain of “count” is integer numbers, the domain of “name” is a string of characters, and the domain of “size” is real (decimal) numbers. Such domain is called a data type. Every data item is therefore defined by its data type, which determines the nature of the values that can be acquired by the data item. A value corresponding to the data type is called a data type instance. For example, 5 is an instance of the “integer number” data type.

Scalar and Compound Data Types

Elementary data types, which are not composed of parts, are called scalar data types. For example, an integer is a scalar data type. Besides scalar data types, it is possible to create compound data types. Compound data types include sequence (list), structure (tuple), array (vector), etc. For example, a “sequence of real numbers” can be created based on the “real number” data type; an instance of such sequence is, for example, {10, 8, 3, 923}.

Optional Data Items

You can specify that a component need not be present in the instance of a compound data type. Such data item is called optional. Optional data items are identified by the optional keyword in textual representations of data types.

Free Data Types, Analytic Types and Object Types

Data types, as explained above, determine the domain of a certain value. In addition to values, data types also determine objects. An object is, for example, a variable or a data item in the document. An object always has a particular value representing its state. However, the state of the object can change during the course of time. In this sense, the object is determined by type – the type determines the values that can be acquired by the object. Consequently, the object type is a broader category than the value type because, for an object, a constraint on how its value is to be changed can be imposed. The following types are available for objects in addition to the standards types:
♦Forwarded item specifying that the object value should be always equal to the value of another designated object.
♦Computed item specifying that the object value is computed in a particular way from the values of other objects.
♦Inferred sequence specifying that the given object is a sequence produced by ordering, filtering, joining, and applying other operations to data from other sequences.
These basic object types are called analytic types. A compound type containing analytic types is an object type in the proper sense.
Every object type has a free type counterpart determining only the type of the object value without imposing any restrictions on how the object value should change. For example, if there is a computed item whose value is calculated as (a+b)/2, where a and b are integers, the respective free type is an “integer number”. Since object types may be also compound, the free type counterpart of a compound type is the corresponding compound type of the free types of the components.