Next: Record Polymorphism, Previous: Record Slot Naming, Up: Records [Contents]
Slot data directly follows the Record Header in a sequence. By default, all records are initialized to a special value R:empty-slot which indicates that the slot contains no value. 3
xmlns:R="http://mikegerwitz.com/hoxsl/record"
Special element indicating an empty slot.
This value will be automatically converted into the empty sequence by accessor functions.
Definition:
<variable name="R:empty-slot" as="element( R:empty-slot )"> <R:empty-slot /> </variable>
Slots cannot correspond 1-to-1 with sequence items, because they might themselves contain records. Let the slot span ϱ of some slot s be the number of sequence items that constitute its value, and let #S be the number of items in some set S; then,
The first equation is the record span. It accounts for (see Record Slot Offsets):
So, if a record in s contains no nested records, its span will always be 2#T + 2.
All of this allows for dynamically-typed, dynamically-sized records.
• Slot Offsets: |
It is otherwise not possible to indicate the absence of a value, since the empty sequence within a sequence is eliminated—that is, (1, (), 2) eq (1, 2).