Temporarily disable all purity for debug prints
dennis luehring
dl.soluz at gmx.net
Thu Apr 21 22:34:51 PDT 2011
On 17.04.2011 22:45, Andrew Wiley wrote:
> 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?
ok - but what about protected? as a whitebox tester im not able(allowed)
to change productive code,but i need to test through all the code
(especially when doing code-coverage stuff)
More information about the Digitalmars-d
mailing list