Object Value

Each object has a value of some basic type. This type is defined by inhered type representation object.

Value Type

The following scalar types supported in o42a:

Type Description
void The very basic type without value. It is assignment-compatible with any other type.
integer 64-bit integer number.
float 64-bit floating-point number.
string Unicode string of variable length. Its length in bytes is stored as 32-bit integer internally.

There are also compound and special types, like link, array, macro, or directive.

Logical Value

The value has a logical precondition of it’s existence called logical value, which can be either true or false. The value exists only when logical value is true. Even when the object has a void type and its value is meaningless, it still has a logical value.

The logical value of constant expressions is always true:

"value" ~~ Logical value is `true`, value is `value`.
1       ~~ Logical value is `true`, value is `1`.

The logical value can be defined explicitly, by defining it’s requirement:

Positive :=> string (
  Value :=< integer
  Value > 0 ~~A requirement for the value following the comma.~~, = "positive".
)

Positive (*value (= 1))   ~~ Logical value is `true` and the value is `"positive"`.
Positive (*value (= -1))  ~~ Logical value is `false` and the value does not exist.

Also, the logical value can be determined implicitly, from it’s definition expression:

A := integer (False, = 2) ~~ Logical value is explicitly `false`.
B := 3
C := a + b                ~~ Logical value is `false`, because one of operands
                          ~~ is `false` and thus has no value.