How can I dump an expression into log and execute it

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 10 23:57:26 PDT 2014


On 11/07/14 03:35, Delorien wrote:
> Hi,
>
> I have a C macro, which takes an argument, log it and call a function.
> So, if I had a source code like this:
>
> {
>    _logfx(x + 10);
> }
>
> the actual code would be
>
>    DebugLog("x + 10");
>    fx(x + 10);
>
> Can I make similar tricks in the D language?

No, I don't think so. Not without passing it as a string to begin with. 
Or AST macros, which we don't have.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list