referents

built-in shelf

Purpose

OmniMark provides a method of working with all the referents defined in a system by treating them as if they belonged to a shelf called referents. Most of the operations that are available to programmer-defined shelves are available for the referents shelf.

referents behaves like a programmer-defined shelf in that:

  • items on the referents shelf can be indexed by the [...] or {...} operators,
  • the number of items on the referents shelf can be determined, and
  • it can be the subject of a repeat over or using.

The referents shelf is different than programmer-defined shelves in that:

  • new cannot be used to insert a new item on the referents shelf. New referents are created with set referent, or open...as referent.
  • remove cannot be used to insert or remove items on the referents shelf. Referents can be removed by attaching the referent to a stream with reopen, and then discarding the stream.

Various types of operations can be explicitly performed on the referents shelf. These include:

  • getting the current value of a referent (using referents {...})
  • checking whether a referent has been used (using the referents has key test)
  • indexing the referents shelf (using key of referents [...])
  • determining the number of referents that currently exist (using number of referents)
  • checking whether a referent is defined (using the referents is attached or this referent is attached test)
  • iterating over the current referent set (using repeat over referents)
  • setting the default item on the referents shelf (using using referents)