On Tue, 12 Apr 2011 13:18:30 -0400, Walter Bright <newshou...@digitalmars.com> wrote:

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.

That works too. I was giving an alternative that should work in the current compiler :)

Also, please allow debug(XYZ) writeln("in foo()");

-Steve

Reply via email to