digitalmars.D.bugs - [Issue 5207] New: Immutability is broken in module constructor
- d-bugmail puremagic.com (27/27) Nov 12 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5207
- d-bugmail puremagic.com (25/25) Nov 12 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5207
- d-bugmail puremagic.com (12/12) Jul 01 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5207
- d-bugmail puremagic.com (8/8) Jul 02 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5207
http://d.puremagic.com/issues/show_bug.cgi?id=5207 Summary: Immutability is broken in module constructor Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid, diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bugzilla kyllingen.net 07:23:03 PST --- Example: immutable int i; static this() { assert (i == 0); i = 1; assert (i == 1); } The compiler should give a "variable not initialised" error on the first assert. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5207 Lars T. Kyllingstad <bugzilla kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Immutability is broken in |Immutability is broken in |module constructor |constructors 08:24:54 PST --- This actually holds for all constructors, not just module constructors: struct S { immutable int i; this(int k) { assert (i == 0); i = k; assert (i == k); } } void main() { auto s = S(1); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5207 hsteoh quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh quickfur.ath.cx Isn't this by design? In my understanding, ctors allow you to assign once, and thereafter further assignment is prohibited. Otherwise, you couldn't have runtime-initialized immutables, such as AA's. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 01 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5207 02:01:08 PDT --- I'm not suggesting that the assignment be prohibited. Rather, I think it should be illegal to *access* the variable before it is initialised. If the current behaviour is by design, consider this an enhancement request. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 02 2013