Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 10, 2010 [Issue 5038] New: Change class 'invariant' syntax to emulate 'unittest' | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5038 Summary: Change class 'invariant' syntax to emulate 'unittest' Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: ah08010-d@yahoo.com --- Comment #0 from Austin Hastings <ah08010-d@yahoo.com> 2010-10-10 15:09:58 PDT --- Presently a class invariant is required to be a single function: class C { int height; int width; invariant() { assert( height < 10 ); assert( width < 11 ); } } For large and/or complex classes, it would improve locality if the invariant could be specified piecemeal, in much the same was that unittest blocks are stitched together into a whole: class C { int height; invariant { assert( height < 10 ); } int width; invariant { assert( width < 11 ); } } The parentheses after invariant seem useless, too - also very much like unittest. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 10, 2010 [Issue 5038] Change class 'invariant' syntax to emulate 'unittest' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | http://d.puremagic.com/issues/show_bug.cgi?id=5038 Austin Hastings <ah08010-d@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 10, 2010 [Issue 5038] Change class 'invariant' syntax to emulate 'unittest' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | http://d.puremagic.com/issues/show_bug.cgi?id=5038 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2010-10-10 15:34:59 PDT --- About invariant syntax see also bug 3856 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 16, 2013 [Issue 5038] Change class 'invariant' syntax to emulate 'unittest' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | http://d.puremagic.com/issues/show_bug.cgi?id=5038 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies@gmail.com Resolution| |DUPLICATE --- Comment #2 from yebblies <yebblies@gmail.com> 2013-01-17 01:28:15 EST --- The parentheses are necessary, because without them invariant is a deprecated alias for immutable. *** This issue has been marked as a duplicate of issue 6453 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 16, 2013 [Issue 5038] Change class 'invariant' syntax to emulate 'unittest' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | http://d.puremagic.com/issues/show_bug.cgi?id=5038 --- Comment #3 from bearophile_hugs@eml.cc 2013-01-16 10:01:17 PST --- (In reply to comment #2) > The parentheses are necessary, because without them invariant is a deprecated alias for immutable. Eventually that alternative meaning will go away, so invariant for structs/class instances will be free to drop the useless (). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 17, 2013 [Issue 5038] Allow declaring class invariant without parentheses | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | http://d.puremagic.com/issues/show_bug.cgi?id=5038 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Platform|Other |All Resolution|DUPLICATE | Summary|Change class 'invariant' |Allow declaring class |syntax to emulate |invariant without |'unittest' |parentheses OS/Version|Windows |All --- Comment #4 from yebblies <yebblies@gmail.com> 2013-01-17 11:41:39 EST --- Fair enough. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 17, 2013 [Issue 5038] Allow declaring class invariant without parentheses | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | http://d.puremagic.com/issues/show_bug.cgi?id=5038 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com --- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-16 16:46:22 PST --- (In reply to comment #4) > Fair enough. The deprecation page lists it as deprecated since 2.057, but the Error and Gone dates are empty. I'm not sure what the plan is, but I doubt there's any *compilable* D2 code out there that actually uses invariant instead of immutable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 17, 2013 [Issue 5038] Allow declaring class invariant without parentheses | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | http://d.puremagic.com/issues/show_bug.cgi?id=5038 --- Comment #6 from yebblies <yebblies@gmail.com> 2013-01-17 11:55:15 EST --- (In reply to comment #5) > The deprecation page lists it as deprecated since 2.057, but the Error and Gone dates are empty. I'm not sure what the plan is, but I doubt there's any *compilable* D2 code out there that actually uses invariant instead of immutable. The general idea is to leave at least six months between deprecation stages. The version numbers are missing because there is no fixed release schedule, and no guarantee the change would be pulled in time to match any projected date. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 17, 2013 [Issue 5038] Allow declaring class invariant without parentheses | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | http://d.puremagic.com/issues/show_bug.cgi?id=5038 --- Comment #7 from Don <clugdbug@yahoo.com.au> 2013-01-17 01:28:22 PST --- (In reply to comment #6) > (In reply to comment #5) > > The deprecation page lists it as deprecated since 2.057, but the Error and Gone dates are empty. I'm not sure what the plan is, but I doubt there's any *compilable* D2 code out there that actually uses invariant instead of immutable. I am 100% sure that is true. 'invariant' only meant 'immutable' for a very short period of time, when hardly anyone was using D2, and when D2 was completely experimental and not seriously usable. > > The general idea is to leave at least six months between deprecation stages. The version numbers are missing because there is no fixed release schedule, and no guarantee the change would be pulled in time to match any projected date. Well, this is a very strange situation. invariant without parentheses is LEGAL IN D1! When converting D1 code to D2, you get this nonsense deprecation message asking you to use immutable instead. We have existing production code which uses invariant without parentheses! We should make it legal again. This would be an undeprecation, which AFAIK has never happened before in D. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation