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'.
  • Re: enums bearophile via Digitalmars-d-learn
    • Re: enums Philippe Sigaud via Digitalmars-d-learn
      • Re: enums H. S. Teoh via Digitalmars-d-learn
        • Re: enums Philippe Sigaud via Digitalmars-d-learn
  • Re: enums monarch_dodra via Digitalmars-d-learn
    • Re: enums Andrej Mitrovic via Digitalmars-d-learn
      • Re: enums Miles Stoudenmire via Digitalmars-d-learn
      • Re: enums bearophile via Digitalmars-d-learn
        • Re: enums Paul D Anderson via Digitalmars-d-learn
          • Re: enums bearophile via Digitalmars-d-learn
          • Re: enums Timon Gehr via Digitalmars-d-learn
          • Re: enums monarch_dodra via Digitalmars-d-learn
            • Re: en... Chris Nicholson-Sauls via Digitalmars-d-learn
              • Re... bearophile via Digitalmars-d-learn
              • Re... Chris Nicholson-Sauls via Digitalmars-d-learn
        • Re: enums Philippe Sigaud via Digitalmars-d-learn
  • Re: enums Ali Çehreli via Digitalmars-d-learn
    • Re: enums Philippe Sigaud via Digitalmars-d-learn
    • Re: enums Steven Schveighoffer via Digitalmars-d-learn
      • Re: enums Philippe Sigaud via Digitalmars-d-learn
  • Re: enums via Digitalmars-d-learn

Reply via email to