Struct
A struct
is an union of pair
s within a scope. A struct
can contain pair
s with any key type, including another struct
: this is one of ALT’s more unique features.
A struct
is the most important structure in ALT because it naturally defines a scope. A struct
has an extra constraint (but not strictly so) that all keys should be kept disjoint in order to keep a struct
lean and mean.
Disjointness is maintained because of how of union, intersection and optionality interact logically, and because a special optional pair
is added to every struct
during parse time. This special pair
also determines whether a struct
is open or closed. A struct
can be turned to open or closed via the turn ~
operator. A struct
is open by default.
The following example demonstrates the internal encoding of a struct
: