On 05/31/2014 11:21 PM, Paul D Anderson wrote:
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. ;)
'const' is just as badly named, but for some reason this fact doesn't
get nearly as much attention. IMO 'enum' should be 'const' and 'const'
should be 'readonly'.