Contracts for delegates

bearophile bearophileHUGS at lycos.com
Tue Jan 8 03:14:38 PST 2013


How do you add contracts to delegates?

This doesn't work:


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

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


Nor this:


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

     foo = (x) {};
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list