digitalmars.D.bugs - [Issue 6648] New: fix invariant
- d-bugmail puremagic.com (29/29) Sep 11 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6648
- d-bugmail puremagic.com (19/19) Sep 11 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6648
- d-bugmail puremagic.com (13/13) Sep 11 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6648
http://d.puremagic.com/issues/show_bug.cgi?id=6648 Summary: fix invariant Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: timon.gehr gmx.ch Consider: struct S{ int x=1; invariant(){assert(x==1);} void foo(){x=2;bar(1);} void bar(int i){x=i;} } void main(){ S s; s.foo(); } This should run fine, but currently it throws an AssertError. Because of this, D's invariant is mostly useless outside toy examples. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 11 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6648 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies gmail.com Summary|fix invariant |Only call invariant once | |for a tree of public | |functions Severity|normal |enhancement I've changed the title to better reflect what (I think) you're asking for. Please correct if I've missed the point. Note that the compiler is working exactly to spec here (for once), so this is an enhancement. An alternative approach is to make bar private/protected, or put the body of bar into a private/protected function that both foo and bar can call. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 11 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6648 timon.gehr gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX If it works for private functions that is fine. I could have sworn I tried it both with private and public bar, but private bar seems to work. I am closing this. sry for the noise. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 11 2011