Ordinal types

Ordinal types have the following characteristics:

  • Ordinal types are countable and ordered. This property allows the operation of functions as inc, ord, dec on ordinal types to be defined.
  • Ordinal values have a smallest possible value. Trying to count further down than the smallest value produces a panic or a static error.
  • Ordinal values have a largest possible value. Trying to count further 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. For reasons of simplicity of implementation the types uint and uint64 are not ordinal types. (This will be changed in later versions of the language.)

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