A question about DbC
Jonathan M Davis
jmdavisProg at gmx.com
Sat Oct 9 03:44:41 PDT 2010
On Saturday 09 October 2010 03:25:48 Denis Koroskin wrote:
> Well, I meant they are conceptually pure.
Yes, they are conceptually pure, just not actually pure.
> But do believe you shouldn't be able to use writeln in code like that. Why
> would you do it anyway? It's more or less like using assert just for a
> console output:
>
> try {
> assert(false, "message");
> } catch {
> }
>
> Put your logging stuff into the body, not into the contracts.
It's for debugging, not logging. It's highly useful for stuff like figuring out
which a contract is failing. That's the main reason why contracts are only
conceptually pure rather than actually pure.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list