Feature request: with for enums
Ary Borenszweig
ary at esperanto.org.ar
Mon Mar 10 05:40:15 PDT 2008
Janice Caron wrote:
> 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).
I think using enums without fully qualifying them is a planned feature
for D2. At least it says that in the first slides:
http://d.puremagic.com/conference2007/speakers.html (see Enum Member
Lookup Rules)
So maybe with won't be necessary for enums.
More information about the Digitalmars-d
mailing list