Nick Sabalausky wrote:
"Bill Baxter" <[email protected]> wrote in message
news:[email protected]...
On Tue, Dec 8, 2009 at 2:17 PM, hehe45 <[email protected]> wrote:
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.
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
That's basically what it is now:
enum { A,B,C } --> A,B,C global
The difference though is that doesn't make A, B and C part of a new type.
Which is a very good thing, from my perspective. I cut down the size of
the Derelict libraries quite a bit when I converted all the named enums
and other constants into anonymous enums, thereby eliminating all the
TypeInfo objects. In that particular case, TypeInfo is just useless
bloat, IMO.
Personally, I'm fine with that though (well, except for the whole "let's
pretend manifest constants are an 'enum'" absurdity), because I *hate* enums
that pollute the namespace with their members.