On Monday, 21 November 2016 at 20:59:32 UTC, Timon Gehr wrote:
How about this alternative ("in" and "out" blocks inside function body):

void foo(int a)
{
    in
    {
        assert (a > 0);
    }
    out
    {
        (ret) assert(ret > 0);
    }

    // body code

    return a;
}


or for one-liners:

void foo(int a)
{
    in assert (a > 0);
    out (ret) assert(ret > 0);

    // body code

    return a;
}

BR,
Piotrek

Won't work. Contracts are part of the function signature. That's the point.

How does "auto" work? Can't the inner in&out be applied to the signature?

BR,
Piotrek

Reply via email to