Temporarily disable all purity for debug prints

bearophile bearophileHUGS at lycos.com
Tue Apr 12 13:11:41 PDT 2011


Steven Schveighoffer:

> Well, yes.  So?  How does the compiler establish rules to separate "safe  
> debug printing" from "all code that isn't pure"?  If you did that, how  
> does the compiler know it's safe?  The only way I can think of is to treat  
> writeln specially, which doesn't sound like the right thing to do.

In the first post in this thread I have suggested a possible solution that avoids that unsafety, a compilation switch to disable all pure annotations in the program/compilation unit. Then you are able to add printing statements in a version{} relative to this compilation switch.

Bye,
bearophile


More information about the Digitalmars-d mailing list