Next: , Previous: , Up: Top   [Index]


3 Types And Values

aime is a statically typed programming language and that means that everything has a type in aime: every variable, every expression, and that the type can be determined by examining the aime programs. And while aime does feature both true and pseudo typeless interfaces, the statically typed character of the language in never broken.

The aime data types are intrinsic and extrinsic. The former are recognized by the aime interpreter proper, the latter are defined outside the interpreter proper.

The intrinsic types are the numeric ‘integer’ type (corresponding integer numbers), ‘cardinal’ type (positively defined integer numbers) and ‘real’ type (real numbers), the string ‘text’ type and the improper ‘void’ type (corresponding no value).

The extrinsic types are added by the application embedding the aime interpreter. There is no way to define data types in the aime programs.

The types allowed by the standalone aime interpreter include ‘list’ (an arbitrary order collection or sequence), ‘file’ (commonly referring a system wide file, but could describe an in memory storage), ‘date’ (calendaristic indication), ‘time’ (describing time intervals, in effect nothing but a number), ‘record’ (an associative array or map, with keys of the intrinsic string type).

The values corresponding the intrinsic types are immediate. An ‘integer’ variable may hold values such as 0, 1, 2, 1000000. Beyond the numerical value there is nothing to an ‘integer’ value. Equality and identity are equivalent.

The values of the extrinsic types may be immediate aswell, or may be fully referable. Or may be something in between. The character of the extrinsic types is determined by the application that introduced them.

The extrinsic types made available by the libraries accompanying the aime interpreter are referable types. That means that every value indicates (or hints, or points) a datum, an object, one that is not solely determined by the indicating value. The objects (‘list’s, ‘file’s, etc) may be hinted by more than one value. It may help to look at values of referable data types as mere pointers, hints, addresses of the real things. The value of a variable of a hypothetical and referable ‘house’ type would not be a house by itself, but a fully qualified address (number, street, city, state). Another variable of the ‘house’ type may have the same value, and if that’s the case both variables indicate the same house, the same object.

For the referable types, equality and identity are different concepts. Values are equal if the objects they point are alike, objects are equal if they are alike. Values are identical if they point the same object, objects are identical is they are one and the same.

Values and in a statically typed language, variables and (sub)expressions have types corresponding their different nature. Operations are defined on specific types. Multiplying real numbers appeal to sense, but multiply strings has no obvious meaning. The statically typed character of aime means that many attempts at undefined operations are detected before the programs are executed. A too strongly typed character proves a nuisance often though, and aime will convert between similar types when the types do not match.

sin(1)’ is allowed despite the fact that the literal ‘1’ is an ‘integer’ value and the ‘sin’ function expects a ‘real’ argument, because the ‘integer’ value is converted to a ‘real’ one. Implicit convertions are performed for function arguments and returns and many library functions will do convertions themselves, but there are still many contexts in which no implicit convertion is done.


Next: , Previous: , Up: Top   [Index]