1.2.70 $SCOPEDENUMS Control use of scoped enumeration types

The boolean $SCOPEDENUMS directive controls how enumeration type values are inserted in the symbol tables. In its default state (OFF) the enumeration values are inserted directly in the symbol table of the current scope. If the directive is set to ON then the values are inserted inside a scope with the name of the enumeration type.

Practically this means that the following is the default behaviour:

{$SCOPEDENUMS OFF}  
Type  
  TMyEnum = (one,two,three);  
 
Var  
  A : TMyEnum;  
 
begin  
  A:=one;  
end.

The value one can be referenced directly. The following will give an error:

begin  
  A:=TMyEnum.one;  
end.

However, if the SCOPEDENUMS directive is set to ON, then the assignment must be made as follows:

{$SCOPEDENUMS ON}  
Type  
  TMyEnum = (one,two,three);  
 
Var  
  A : TMyEnum;  
 
begin  
  A:=TMyEnum.one;  
end.

i.e. the value must be prefixed with the type name.