|
|||||
Opaque data types | |||||
Prerequisite Concepts | Related Syntax |
opaque
is a mechanism to extend OmniMark's data types. Opaque types encapsulate values that exist outside of OmniMark and are manipulated using external functions. Opaque data types are instantiated as shelf variables as are all other OmniMark data types, such as counters, switches, or streams. Shelf items in an opaque
shelf hold references to opaque values, not the values themselves. All shelf operations can be applied to opaque
shelves.
To create and use an opaque
shelf, several aspects of the new data type must be defined: name, creator function, copy function and terminator function. The name is used to identify the opaque data type, and must be unique throughout the OmniMark program. An opaque type's creator function is used to create the new values. The copy function is used when the opaque values are passed from shelf to shelf, or passed as value arguments to internal or external functions. When an opaque value is removed from a shelf, or the shelf goes out of scope (either global or local), the terminator function is called, signalling that OmniMark will no longer reference the value.
Prerequisite Concepts External functions |
Related Syntax opaque |
---- |