Type Tag
TypeTag is an enumeration that corresponds with the basic type structure of Avail's type lattice. Even though the type lattice contains an infinite collection of infinitely long chains of types, some of which have an infinite number of direct ancestors and direct descendants, we're still able to extract a pragmatic tree of types from the lattice.
Since this restricted set of types form a tree, they're defined in such an order that all of a type's descendants follow it. Since this is recursively true, the types are effectively listed in depth-last order. The ordinals are assigned in the order of definition, but each type keeps track of the maximum ordinal of all of its descendants (which occupy a contiguous span of ordinals just after the type's ordinal). We can test if type A is a subtype of B by checking if a.ordinal ≥ b.ordinal and a.highOrdinal ≤ b.highOrdinal. For a proper subtype test, we turn the first condition into an inequality.
Author
Mark van Gulik
Parameters
Entries
Types
Functions
Properties
The array of Contravariant relationships defined during construction.
The array of Covariant relationships defined during construction.
The highest ordinal value of all of this TypeTag's descendants, including itself. The descendants' ordinals must start just after the current TypeTag's ordinal, and be contiguously numbered. Since the ordinals are assigned by the Enum mechanism, that means a TypeTag definition must be followed immediately by each of its children and their descendants, which is prefix tree order.
A flag set during initialization, indicating this TypeTag has no direct instances.
Some TypeTags occur in exactly one AvailObject. If so, this field will be initialized to a lambda that produces the value.