Why are immutable fields with initializers deprecated?

2014-04-29 Thread Andrei Alexandrescu via Digitalmars-d
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

Re: Why are immutable fields with initializers deprecated?

2014-04-29 Thread Steven Schveighoffer via Digitalmars-d
On Tue, 29 Apr 2014 13:09:01 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: 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? I

Re: Why are immutable fields with initializers deprecated?

2014-04-29 Thread Kenji Hara via Digitalmars-d
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:

Re: Why are immutable fields with initializers deprecated?

2014-04-29 Thread Nick Treleaven via Digitalmars-d
On Tuesday, 29 April 2014 at 17:11:50 UTC, Steven Schveighoffer wrote: On Tue, 29 Apr 2014 13:09:01 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: A recent discussion https://github.com/D-Programming-Language/dmd/pull/3452 brought up a matter I'd forgotten - struct fields

Re: Why are immutable fields with initializers deprecated?

2014-04-29 Thread Andrei Alexandrescu via Digitalmars-d
On 4/29/14, 10:18 AM, Kenji Hara via Digitalmars-d wrote: 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