Dmitry Olshansky:

Then it has to be part of the type (a meta-info bound to it)...

In the first case the contracts are shared by all delegates, so there is no need for code equality:

void main() {
    void delegate(int x) foo
    in {
        assert(x > 0);
    };

    foo = (x) {};
}


If the contracts are attached to the function, can't you just trust the programmers to use compatible contracts, so again there's no need to compare code?

void main() {
    void delegate(int) foo;

    foo = (x)
    in {
        assert(x > 0);
    } body {
    };
}


Bye,
bearophile

Reply via email to