On 4/12/2011 8:03 AM, Steven Schveighoffer wrote:
use C linkage, you can do whatever you want. It's how druntime accomplishes a
lot of stuff.

For example:

puredebug.d:

import std.stdio;

extern(C) void pureprint(string[] values...)
{
write("[pure debug] ");
foreach(value; values)
write(value);
writeln();
}

puredebug.di:

extern(C) void pureprint(string[] values...) pure;

Should work.

Yes. But it occurs to me to take the subject title literally - allow impure code inside debug statements, as in:

pure void foo()
{
    debug writeln("in foo()");
}

Simple and effective.

Reply via email to