enhancing enums

bearophile bearophileHUGS at lycos.com
Tue Dec 8 14:57:25 PST 2009


hehe45:

> In c++ it is valid syntax to have trailing commas at the and of enum definitions:
> enum {a, b, c, };
> This would be a useful addition to D too.

I think that's already possible in D1.


> The enum class syntax from c++0x should also adopted by D, this would allow named enums which are not automatically encased by a namespace:
> 
> enum EnumName {A, B, C};       ---> A, B and C are global constants
> enum class EnumName {A, B, C};---> A, B and C are in the EnumName namespace

Global constants are a little dangerous, I don't like that.

Bye,
bearophile



More information about the Digitalmars-d mailing list