iterate over enum name:value pairs

bearophile bearophileHUGS at lycos.com
Mon Dec 9 02:21:49 PST 2013


Jay Norwood:

> I notice that if Suit and SuitShort have an enum with the same 
> name, then you still have to fully qualify the enum names when 
> using the with statement.  So, for example, if spd in SuitShort 
> was renamed spades, the first entry in the array initialization 
> would have to be {Suit.spades, 1, 6, SuitShort.spades}.

Yes, that's named anti-shadowing, the D type system tried to 
avoid such bugs in your code.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list