June 01, 2014
On Sat, May 31, 2014 at 10:14 PM, bearophile via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:

>> 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 (...)

Now that we have immutable's that can be used inside templates, why use an enum? Because it's 'inlined' in the code?

(I know the reason not to use it for an array or associative array, I experimented that fully in my own code. Ouch!)
June 01, 2014
On Saturday, 31 May 2014 at 22:45:32 UTC, bearophile wrote:
> Chris Nicholson-Sauls:
>
>> Good... I was starting to fear I was the only one.
>
> In general you can't fix the names in a language because you always find someone that likes the ones present :) I think "enum" is a bad name for the purpose of defining manifest constants, but I don't think this will change.
>
> Bye,
> bearophile

In a perfect world, sure, we'd have a different name for it; I'm not saying I love it, just that it "makes sense" in my head.  I've sometimes thought 'alias' could have worked as well, especially now with the a=b syntax.

alias DEFAULT_PORT = 11020;

But, then we exchange one set of brow raisers for another set.  In the absence of #define, there probably is no achievable ideal.  :)
1 2 3
Next ›   Last »