On 10/21/14 12:02 PM, Gary Willoughby wrote:
On Tuesday, 21 October 2014 at 15:45:55 UTC, Steven Schveighoffer wrote:
Currently, if you write something like this:

debug = x;

In code? Like this:

void main()
{
     debug = x;

     // now in debug mode even though not specified on the CLI?
}


Yes, but only for debug(x) statements. debug statements without a symbol aren't enabled. But for those statements, purity is jettisoned. e.g.:

import std.stdio;
int a;

void foonotpure() { a = 5; writeln("yep, not pure");}

debug = x; // note this is only allowed at module scope.
void main() pure
{
   debug(x) foonotpure();
}

dmd -run foonotpure.d
yep, not pure

If that's true, that's pretty scary. What if it's hidden in a module
somewhere?

Yep, you can just turn off purity when it gets in the way.

-Steve

Reply via email to