www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3400] New: scope(failure) is not allowed in contracts

reply d-bugmail puremagic.com writes:
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



---
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: -------
Oct 14 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3400


Koroskin Denis <2korden gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



---
*** 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: -------
Nov 24 2009