enums

Paul D Anderson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 31 14:21:58 PDT 2014


On Saturday, 31 May 2014 at 20:14:59 UTC, bearophile wrote:
> Miles Stoudenmire:
>
>> In contrast to those two examples where immutable can be used 
>> at compile
>> time, what are some other cases where it is necessary to use 
>> enum instead of immutable?
>
> By default use enum if you define a compile-time-known value, 
> unless it's composed data like an array, etc.
>
> Bye,
> bearophile

'enum' as a manifest constant keyword has been an unpopular 
decision from its introduction. "Everybody" agrees that it should 
be changed. Everybody but Walter -- at DConf2014 Walter said 
(again) that using "enum" was okay because people get used to it!

The only reason given is that re-using a keyword is supposed to 
be easier than introducing a new one. That is manifestly false. ;)


More information about the Digitalmars-d-learn mailing list