www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Very minor Enum proposal

I know there has been a lot of debris flying about fancy enums able to 
stringize their values etc, but I have a much more modest proposal.

I'd like to be able to get the value of an enum member as a the 
underlying type via a property, say '.val'.

This would allow me to use something like this:

      const x = MyEnum.AMember.val;

Instead of this:

      const x = cast(typeof(MyEnum.init)) MyEnum.AMember;

Apr 23 2007