Communicating between in and out contracts

MIURA Masahiro echochamber at gmail.com
Thu Oct 15 02:20:10 PDT 2009


Andrei Alexandrescu wrote:
>    void push(T value);
>    in {
>       auto oldLength = length();
>    }
>    out {
>       assert(value == top());
>       assert(length == oldLength + 1);
>    }

Another keyword abuse:

void push(T value);
in {
    auto in.oldLength = length();
}
out {
    assert(value == top());
    assert(length == in.oldLength + 1);
}



More information about the Digitalmars-d mailing list