digitalmars.D.bugs - [Issue 6415] New: Placement of pure and nothrow for invariant()
- d-bugmail puremagic.com (30/30) Jul 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6415
- d-bugmail puremagic.com (11/11) Jun 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6415
- d-bugmail puremagic.com (20/27) Jun 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6415
- d-bugmail puremagic.com (13/13) Jun 10 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6415
- d-bugmail puremagic.com (14/14) Jun 10 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6415
- d-bugmail puremagic.com (7/9) Jun 10 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6415
- d-bugmail puremagic.com (22/23) Jun 10 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6415
http://d.puremagic.com/issues/show_bug.cgi?id=6415 Summary: Placement of pure and nothrow for invariant() Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc --- Comment #0 from bearophile_hugs eml.cc 2011-07-30 19:46:08 PDT --- This code shows a problem with placement of pure and nothrow: class Foo { pure nothrow invariant() {} // OK invariant() pure nothrow {} // Error } void main() {} DMD 2.054 gives: test.d(3): statement expected to be { }, not pure test.d(3): basic type expected, not { test.d(3): no identifier for declarator int test.d(3): semicolon expected, not '{' test.d(3): Declaration expected, not '{' test.d(5): } expected following member declarations in aggregate -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6415 Henning Pohl <henning still-hidden.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull CC| |henning still-hidden.de --- Comment #1 from Henning Pohl <henning still-hidden.de> 2013-06-09 18:04:47 PDT --- https://github.com/D-Programming-Language/dmd/pull/2156 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6415 --- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2013-06-09 18:19:12 PDT --- (In reply to comment #0)This code shows a problem with placement of pure and nothrow: class Foo { pure nothrow invariant() {} // OK invariant() pure nothrow {} // Error } void main() {}Today `invariant {}` is parsed same as `immutable {}` (= `AttributeDeclaration`), because in early D2 age `invariant` had been reused for `immutable` meaning. So `invariant` block requires following `()` to keep backward compatibility. But, eventually the redundant parenthesis would be unnecessary, and you can write invariant block as same as unittest block. And, currently unittest block does not accept postfix attributes. ```d invariant() pure safe nothrow {} // allwed by this change invariant pure safe nothrow {} // eventually allowed? unittest pure safe nothrow {} // currently not allowed ``` Therefore, just only fixing invariant syntax will introduce future inconsistency. So we should consider unittest block syntax at the same time. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6415 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com --- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2013-06-10 10:33:41 PDT --- I'm not convinced anything needs fixing. Why should: invariant() pure nothrow { } be accepted? After all, as Kenji mentioned, the () is to support old code and will eventually go away anyway. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 10 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6415 brian-schott cox.net changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |brian-schott cox.net --- Comment #4 from brian-schott cox.net 2013-06-10 11:07:14 PDT --- So this means that ideally the grammar would be: invariant: 'invariant' blockStatement ; correct? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 10 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6415 --- Comment #5 from bearophile_hugs eml.cc 2013-06-10 14:39:42 PDT --- (In reply to comment #3)After all, as Kenji mentioned, the () is to support old code and will eventually go away anyway.OK. dmd 2.064 is a good moment for that "eventually" to be, see Issue 10326 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 10 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6415 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX --- Comment #6 from bearophile_hugs eml.cc 2013-06-10 14:49:39 PDT --- (In reply to comment #1)https://github.com/D-Programming-Language/dmd/pull/2156Given the recent comments by Walter and Kenji, the two years of Walter's total silence passed since this proposal, and the changes proposed in Issue 10326 , then maybe this whole issue becomes useless. Do we want to write code like this? class Foo { invariant pure nothrow {} } unittest pure nothrow {} void main() {} It's not a good change. So please let me close this issue down. If someone wants to press the issue further then please reopen this issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 10 2013