On 23 May 2013 14:52, Steven Schveighoffer <schvei...@yahoo.com> wrote: > On Thu, 23 May 2013 05:05:01 -0400, Don <turnyourkidsintoc...@nospam.com> > wrote: > >> On Tuesday, 21 May 2013 at 20:36:20 UTC, Walter Bright wrote: >>> >>> >>> Join the dmd beta mailing list to keep up with the betas. This one is >>> pretty much good to go, unless something disastrous crops up. >>> >>> http://ftp.digitalmars.com/dmd2beta.zip >>> >>> Remaining regressions: >>> >>> >>> http://d.puremagic.com/issues/buglist.cgi?query_format=advanced&bug_severity=regression&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED >> >> >> NO NO NO NO. I am violently opposed to this release. >> >> This beta contains the worst language misfeature of all time. It's >> silently snuck in under the guise of a bugfix. >> >> >> struct S >> { >> const int x = 7; >> int y; >> } >> >> In previous releases, S.x was always 7. >> But now, if you write >> >> S s = S(5); >> >> then x gets changed to 5. >> This means that the const variable x has been initialized TWICE! > > >> This new behaviour is counter-intuitive and introduces a horrible >> inconsistency. > > > I disagree. > > struct S > { > const int x; > } > > S s1; // x is 0 > S s2 = S(5); // x is 5 > > Adding an initializer simply changes the default value from 0 to whatever > you want. It's quite consistent IMO. >
Don't think it makes sense in non-POD structs... Haven't tested, but is this an error? struct S { const int; this (int x) { this.x = x; // here } } S(5); Regards -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';