enum and const or immutable ‘variable’ whose value is known at compile time

claptrap clap at trap.com
Thu Sep 17 09:44:20 UTC 2020

On Thursday, 17 September 2020 at 01:57:39 UTC, Mike Parker wrote:
> On Thursday, 17 September 2020 at 00:32:40 UTC, Cecil Ward
> enum foo is essentially a shortcut for enum { foo }. It’s 
> neither bent out of shape nor twisted. Consider that C++ added 
> the new keyword constexpr for the same thing. Why pollute the 
> namespace with a new keyword when you already have one that 
> fits?

Seriously how it's implemented is irrelevant. When people use it 
(for that use case) they arn't thinking ohh right here I want an 
enum with one member. They are thinking I want a constant 
expression evaluated at compile time. IE, C++ got something right 
for once, D let the mechanic name the controls on the dashboard. 
It's an "implementers name" and it's retarded beyond belief. 
Seriously look up enumeration in a dictionary and explain how 
that can be twisted to mean "constant expression" or "evaluated 
at compile time".

Names are important, principle of least astonishment and all 
that, pretty much everyone coming to D is going be WTF in 
learning about that. And if you keep overloading existing 
keywords with more and more meanings the code gets harder and 
harder to grep at first glance.

More information about the Digitalmars-d-learn mailing list