Contracts for delegates

bearophile bearophileHUGS at lycos.com
Tue Jan 8 05:58:39 PST 2013


Benjamin Thaut:

> I don't think that this is possible at all.

I see.


> Do you think this is usefull?

In a program I define a null delegate, then later I assign to it 
one of different functions according to some run time values, and 
later I call the delegate several times. In such situation a 
delegate is handy to shorten my code, where max performance is 
not needed.

I generally use contract programming, because I've seen it 
catches some of my coding mistakes. So what's wrong in desiring 
to add a pre-condition to that delegate? (Currently I have put 
the pre-condition asserts inside the function assigned to the 
delegate).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list