Data types

Basic and markup types are first-class data types: they can be stored in shelves, passed to functions, and returned from them without any loss of information.

Basic types

OmniMark offers three basic data types:

Markup types

The following additional built-in data types describe various parts of markup:

Sources and sinks

The source and sink data types that are specialized for string and markup-event manipulation:

These types are used to construct data transformation pipelines, for either textual data or markup data.

Stream data type

There is one more data type built into OmniMark itself: stream.

The stream data type can be described as a union of string and string sink types. A shelf declared as stream acts as a string when closed, and as a string sink when open.

Opaque data types

opaque data types are data types implemented in an external library. You may declare a shelf of any opaque data type. Some of the external libraries that come with OmniMark implement various opaque data types. Some examples of opaque data types are:

  • BCD (Binary Coded Decimal) numbers
  • float data type for floating point numbers
  • db.database data type representing database connections
  • tcp.connection representing TCP network connections

Numeric types

integer, BCD, and float are all numeric data types. How do you choose the appropriate numeric type for the data you are dealing with?

If you are dealing with whole number quantities with no fractional parts, choose integer or BCD. integer has marginally simpler syntax, but a limited size. Use BCD if numbers could get bigger than an integer can handle. It is also slightly easier to do arithmetic and comparisons between numbers of the same data type, so choose BCD for integer values that will be involved in calculations with other BCD values.

If you are dealing with numerical quantities with fractional parts, choose BCD unless you need to express

  • fractional amounts to an accuracy of more then 16 decimal places,
  • numbers smaller than can be expressed using 16 decimal places, or
  • numbers that are very large, but which have only a limited number of significant digits. (For example, the distance to the Andromeda galaxy in kilometers is a very large number, but it cannot meaningfully or usefully be measured down to the last kilometer.)

In any of the above cases, use float.

When in doubt, use BCD.

There is no appreciable performance advantage in choosing float over BCD.

Note that you should base your choice of numerical types on the set of interacting values rather than on each value individually. Choosing numbers of the same type for all interacting numbers (unless obviously inappropriate) will simplify your code and save on data conversions. Never mix float and BCD numbers in the same calculation; doing so always involves a loss of precision.


The data types listed above can be combined to form more complex data types by using records. A record type is composed of fields, each of which has a data type of its own. This way, records are aggregate data types.

Related Topics