In future release, non-static const or immutable field will be made an
instance field.
struct S
{
immutable int x = 1;
}
static assert(S.sizeof == int.sizeof); // will succeed in the future
So current "implicit static" behavior is now deprecated.
Related:
http://dlang.org/changelog#staticfields
http://dlang.org/changelog#staticfields2
Kenji Hara
2014-04-30 2:09 GMT+09:00 Andrei Alexandrescu via Digitalmars-d <
[email protected]>:
> A recent discussion https://github.com/D-Programming-Language/dmd/pull/
> 3452 brought up a matter I'd forgotten - struct fields that are immutable
> and have initializer are deprecated.
>
> Why?
>
> Andrei
>