[Issue 18945] immutable variable is used as if it's an enum

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 5 14:01:55 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18945

--- Comment #6 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to David Bennett from comment #4)
> I'm not sure what workaround we would recommend in the deprecation messaged
> as the current functionality is actually hard to replicate.

Just use an enum if you want the value to be known and used at compile time,
and use an immutable variable if you want it to be known and used at runtime.
Don't try to have a variable with different values at compile time and runtime.
And if for some reason, you want the value calculated at compile time but to
still have a variable, then use an enum to initialize the immutable variable.
That's what you have to do with mutable variables already.

--


More information about the Digitalmars-d-bugs mailing list