"Timon Gehr" <timon.g...@gmx.ch> wrote in message 
news:jnj92m$306m$1...@digitalmars.com...
> On 04/29/2012 08:35 AM, Nick Sabalausky wrote:
>
>> it's just a series of manifest
>> constants. The fact that they're grouped doesn't even have any semantic
>> consequence, as far as I'm aware.
>
> The only differences are that they don't occupy their own namespace and 
> they don't define their own type. But non-anonymous enums are _just a 
> bunch of manifest constants_ as well!

No, they're not. Non-anon enums *contain* a bunch of manifest constants. But 
what non-anon enums *are* is a type. Anon enums are not a type at all. I 
think that's a significant difference.

Note this is in stark contrast to:

- Classes: Anonymous or not, it's still a type.
- Functions: Anonymous or not, it's still *not* a type.

The syntaxes we have for anon enums and non-anon enums makes them *look* 
like they're basically the same thing, just with/without a name, but that's 
not actually the case.

Of course, my biggest issue by far is with the name "enum". Non-anon enums 
can reasonably be thought of as enumerations (except for bitfields, but I 
think those should be handled differently from enums anyway). But anon-enums 
are just plain not enumerations, period. If we weren't calling them all 
"enum", then I would have much, much less problem with the syntax we have. 
And yea, I get the whole "What's in a name?", but "enum" is just a 
colossally *terrible* name for this. It's worse than when "immutable" was 
called "invariant".


Reply via email to