Ordinal types

Ordinal types have the following characteristics:

  • Ordinal types are countable and ordered. This property allows the operation of functions such as inc, ord, and dec on ordinal types to be defined.
  • Ordinal types have a smallest possible value, accessible with low(type). Trying to count further down than the smallest value produces a panic or a static error.
  • Ordinal types have a largest possible value, accessible with high(type). Trying to count further up than the largest value produces a panic or a static error.

Integers, bool, characters, and enumeration types (and subranges of these types) belong to ordinal types.

A distinct type is an ordinal type if its base type is an ordinal type.