Temporarily disable all purity for debug prints

Walter Bright newshound2 at digitalmars.com
Sat Apr 16 10:19:44 PDT 2011


On 4/16/2011 6:41 AM, bearophile wrote:
>> Yes, it allows one to break the purity of the function. The alternative is
>> to use casts (which also breaks the purity) or another compiler switch
>> (which also breaks the purity).
>
> A compiler switch to disable purity doesn't break purity. It just turns all
> pure functions inside the program (or inside the compilation unit) into not
> pure ones. At this point you are allowed to call writeln too, safely.


Saying it is a safe way to break purity assumes that there was no purpose to the 
purity. There is no guaranteed safe way to break purity, with or without a 
compiler switch.


More information about the Digitalmars-d mailing list