Feature request: enum init shouldn't create a new enumeration

denizzzka 4denizzz at gmail.com
Sat Oct 13 10:58:50 PDT 2012


On Saturday, 13 October 2012 at 15:39:24 UTC, Tommi wrote:
> enum MyEnum
> {
>     init = -123,
>     first = 0,
>     second = 1
> }
>
> void main()
> {
>     static assert(MyEnum.min == -123);
>
>     MyEnum me;
>
>     final switch (me)
>     {
>     case MyEnum.first:  break;
>     case MyEnum.second: break;
>     case MyEnum.init: // I'm forced to specify init case too
>     }
> }


Also, a quick question:

Why in case its need to write name of the enum?

      case first:  break;
      case second: break;
      case init: // I'm forced to specify init case too

looks better for me.


More information about the Digitalmars-d mailing list