Request: nested enums

JS js.mdnq at gmail.com
Mon Jul 15 06:39:00 PDT 2013


I think it would be nice to have such a feature:

enum A
{
    a, b, c
    enum B
    {
       d, e, f
    }
}

this helps with logically nested types.

Possibly A.B returns the first(or possibly default) entry of the 
list(d).

Also, a useful property would be to uniformly distribute the 
enums inside the int range(or make it optional). This makes 
changes to an enum less likely to break things such as 
communications with older apps that use an older version of the 
enum.

Basically each nested enum occupies a range of 1 to N with N 
being relatively large but a fraction of int.max.




More information about the Digitalmars-d mailing list