Structural Values

Contents:

A structural value is an unordered set of members for values.

Note

Structural values, just like strings, are immutable entities. No operation involving an object can, by any means, “mutate” it in place.

Also, a member of an object is only evaluated when required. This process is also known under the name of lazy evaluation, or laziness.

Important

Structural values have a structural type by default. They are therefore type-checked accordingly to the structural subtyping mechanism.

A structural value is represented by a listing of value members surrounded by curly braces { } and each separated by a new line \n or a comma ,.

For instance, the following snippet:

{
    k1: '' = 'value 1'
    k2: '' = 'value 2'
}

represents a structural value defining two members k1 and k2.

Note

A structural value may only define members which identifiers are unique. A structural value that defines duplicated member identifiers abruptly halts the execution of the interpreter with this message:

error: found duplicated definitions for <identifier>:
at <row>:<col>:
    <identifier>: '' = 'value'
    ^
at <row>:<col>:
    <identifier>: Any = {
    ^