Temporarily disable all purity for debug prints
Andrew Wiley
debio264 at gmail.com
Sun Apr 17 13:45:39 PDT 2011
On Sun, Apr 17, 2011 at 3:30 PM, dennis luehring <dl.soluz at gmx.net> wrote:
> On 11.04.2011 23:27, bearophile wrote:
>>
>> From what I am seeing, in a D2 program if I have many (tens or more) pure
>> functions that call to each other, and I want to add (or activate) a
>> printf/writeln inside one (or few) of those functions to debug it, I may
>> need to temporarily comment out the "pure" attribute of many functions
>> (because printing can't be allowed in pure functions).
>>
>> As more and more D2 functions become pure in my code and in Phobos,
>> something like a -disablepure compiler switch (and printf/writeln inside
>> debug{}) may allow more handy debugging with prints (if the purity is well
>> managed by the compiler then I think disabling the pure attributes doesn't
>> change the program output).
>>
>> Bye,
>> bearophile
>
> sounds a little bit like the need to see an private/protected part of an
> interface in unittest scenarios - just to be able to test it in a
> whitebox-testing without changing the attributes of the productive-code
Isn't this already there because "private" makes things visible to all
other code in the same module?
More information about the Digitalmars-d
mailing list