class

Enum

const abstract class Enum : Obj

Enum is the base class for enum classes defined using the enum keyword. An enum models a fixed range of discrete values. Each value has an Int ordinal and a Str name.

Every enum class implicitly has the following slots auto-generated by the compiler:

  • a static const field for each name in the enum's range.
  • a static field called "vals" which contains the list of discrete values indexed by ordinal.
  • a static method called "fromStr" which maps an enum name to an enum instance

See Enums for details.

methods toStr

Always returns name()

compare

Compare based on ordinal value

equals

Enums are only equal if same instance using ===

name

Get the programatic name for this enum

ordinal

Return ordinal value which is a zero based index into values

compare virtual Int compare(Obj obj)

Compare based on ordinal value.

equals virtual Bool equals(Obj? obj)

Enums are only equal if same instance using ===.

name Str name()

Get the programatic name for this enum.

ordinal Int ordinal()

Return ordinal value which is a zero based index into values.

toStr virtual Str toStr()

Always returns name().

Haxall 4.0.5 ∙ 24-Feb-2026 14:33 EST