Next: , Previous: , Up: Records   [Contents]


2.4 Record Slot Data

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

variable: element( R:empty-slot ) R:empty-slot ()

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):

  1. A Record Header (one item);
  2. The record span (one item);
  3. #T items to hold the offset for each slot (see Record Slot Offsets); and
  4. ∑ᵢϱ(tᵢ) items to hold all slot contents.

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.


Footnotes

(3)

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).