Range Enum Types

From The Oxygene Language Wiki

Jump to:navigation, search


A new feature in the May 2009 release is support for Integer ranges, a familiar feature to Pascal/Delphi users.

type
  MyRange = 1 .. 10;

The compiler will find the closest integer type and add some metadata to this type to specify it's a range type. The compiler will return the low and high when calling the Low and High compiler functions. It will treat these as regular integer types after finding the closest matching integer type. Other compiler will see this type as a normal integer type, Prism will see it as a range type when defined in external assemblies. When assigning constants the compiler will check if they are in range, when the overflow option is set, the compiler will enforce the range.

$R+, $R-, $RANGE ON, $RANGE OFF, $RANGE DEFAULT

The above flags influence range checking in the Prism compiler. When set to ON or +, assignments and casts to ranges will be checked for their ranges.

Navigation
Areas
More
Toolbox