October 14, 2009 [Issue 3400] New: scope(failure) is not allowed in contracts | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3400 Summary: scope(failure) is not allowed in contracts Product: D Version: 2.031 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: 2korden@gmail.com --- Comment #0 from Koroskin Denis <2korden@gmail.com> 2009-10-14 07:40:55 PDT --- import std.stdio; int sqrt(int i) out (result) { scope (failure) writeln("ooops"); assert(result * result == i); } body { return i / 2; // buggy implementation :) } Error: Throw statements cannot be in contracts I'm not sure if it's a good idea to disallow throw statements in contracts: It's so easy to overcome this restriction (by calling assert or any other function that will throw) that I don't think it's worth the trouble. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 24, 2009 [Issue 3400] scope(failure) is not allowed in contracts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Koroskin Denis | http://d.puremagic.com/issues/show_bug.cgi?id=3400 Koroskin Denis <2korden@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #1 from Koroskin Denis <2korden@gmail.com> 2009-11-24 04:04:42 PST --- *** This issue has been marked as a duplicate of issue 3388 *** -- 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