The Death of D1. (Was Tango vs Phobos)

Robert Fraser fraserofthenight at gmail.com
Mon Aug 25 17:39:26 PDT 2008


superdan wrote:
> it's a big issue to me just in the opposite direction. the c enum is brain damaged. even dennis ritchie so much as acknowledged it. (and he won't budge on the definition syntax. so i guess that does mean somethin'.) the c++ enum grew one lonely neuron. problem is we got just used to the wrong. we won't blink an eye at
> 
> enum { a = 1, b = 2 };
> 
> but we get pissed at
> 
> enum { a = 1.1, b = 2.5 };

I see the first as a problem, too. An enum is an _enumeration_. It 
should not be abused for bitfields, masks, constants or anything else. 
Look at how it's used in Java/C# (ignoring the fact that Java's enum is 
actually syntactic sugar for a class...):

- Only named enums are supported (otherwise, what are you enumerating?)
- They can't be used as bitfields/masks (constants can be used for this 
purpose)
- You can't define them as arbitrary values.

In D, it's all water under the bridge and it's just a keyword; it 
doesn't matter that much. That being said, it's still a bad selection of 
keyword IMO and there's no argument that's going to convince me that 
`enum string CRLF = "\r\n";` is somehow an _enumeration_.



More information about the Digitalmars-d mailing list