Feature request: with for enums

Janice Caron caron800 at googlemail.com
Mon Mar 10 02:54:12 PDT 2008


I would like to be able to do

    enum MyEnum
    {
        first, second, third, fourth, fifth, sixth, seventh eighth
    }

    MyEnum[100] table =
    [
        MyEnum.first,
        MyEnum.second,
        MyEnum.eighth,
        MyEnum.first,
        ...
    ];

without all that ridiculous qualifying. Maybe it's possible to do that
already, but if so, I haven't found anything which compiles. I would
have expected the following to work, but it doesn't:

    with(MyEnum) MyEnum[100] table =
    [
        first,
        second,
        eighth,
        first,
        ...
    ];

Apparently, "with" only works with structs and classes - not enums.
I'm wondering if this can be extended and made to work also with
enums?

(...or if there's something I've missed, someone please tell me).



More information about the Digitalmars-d mailing list