In an e file, it's perfectly legal to say:
print 5;
But at the same time, the following thing doesn't work:
type some_type_e : [ VAL1, VAL2 ];
print VAL2; // issues a compile error
The parser expects VAL2 to be a variable name and doesn't interpret it as a constant.
At the same time, this is allowed:
var some_int : int = 10;
if some_int != 5 {
print "Some int not 5"
};
var some_enum : some_type_e = VAL1;
if some_enum != VAL2 {
print "Some enum not VAL2";
};
In this case, VAL2 is interpreted as a constant.
The (simplified) syntax for print is print <exp>
. Is an enum literal not an expression?