Is there any reason to pick one of these vs. another one, or are
they all equivalent?
If equivalent, it would seem that immutable appears to be the
'strongest', whereas enum has fewer keystrokes.
Is there a D 'best practice' for this?
```
const int foo1 = 42;
enum foo2 = 42;
On Wed, Sep 10, 2025 at 05:15:16PM +, monkyyy via Digitalmars-d-learn wrote:
[...]
> I just do always enum; going all in on compile time abstractions
Be careful, this may not always be what you want. For example:
```d
enum data = [ 1, 2, 3 ];
void main() {
auto buffer = data; //
On Wednesday, 10 September 2025 at 17:33:48 UTC, H. S. Teoh wrote:
`enum` defines a compile-time constant. It occupies no space,
and its value is "copied" into every expression in which it
appears.
[...]
`const` and `immutable` are type qualifiers, and declaring a
constant with them creates a
On Wed, Sep 10, 2025 at 04:52:51PM +, Brother Bill via Digitalmars-d-learn
wrote:
> Is there any reason to pick one of these vs. another one, or are they
> all equivalent?
[...]
They are most definitely not equivalent.
`enum` defines a compile-time constant. It occupies no space, and its
va
On Wednesday, 10 September 2025 at 16:52:51 UTC, Brother Bill
wrote:
Is there any reason to pick one of these vs. another one, or
are they all equivalent?
If equivalent, it would seem that immutable appears to be the
'strongest', whereas enum has fewer keystrokes.
Is there a D 'best practice