SuivantPrec.Bas prec.BasNiv. sup.

Chapter 5 The type concept in ASET 

ASET has a variable built-in type concept. It is based on the fact that each value can be interpreted in different ways, according to the underlying basic data types. There are four basic data types, with the given semantics:

String Each value is a string
Real Some strings are real numbers
Integer Some reals are integers
BooleanSome integers are booleans

Consider some examples:

'Auto'is a string, no real, no integer, no boolean
'1.4e-1'is a string, a real, no integer, no boolean
'100' is a string, a real, an integer, no boolean
'1' is a string, a real, an integer, a boolean (true)
" is a string, no real, no integer, no boolean

The definition of valid reals and integers is the usual one. Note that they are always unsigned, because the - is treated as an operator (unary -). The definition of boolean values is:

0represents the value false
1 represents the value true

Now we head towards an extension of this type concept: Consider the value '1.4e-1' again. We can interpret this value as an integer by applying the function 'round' to it, which makes it an integer 0. In a similar way we define each integer to be a boolean value by applying the function 'signum', which means: boolean is false, if integer is zero, and true, if integer is not zero. Let's return to our example and show all possible interpretations:

String valueReal IntegerBoolean
'Auto' 0.0 0 false
'1.4e-1' 0.14 0 false
'100' 100.0100 true
'1' 1.0 1 true
" 0.0 0 false
'0.5' 0.5 1 true

The last entry shows the effect of the 'round' function which returns the nearest integer and, if the number lies between two integers, takes the larger one.

ASET will automagically choose the strongest lossless representation for the results of operations. That means, that the result of '0.5'+'0.5' is inter- preted as '1', ie. an integer value, not '1.0', a real value.

SuivantPrec.Bas prec.HautNiv. sup.