How can I dump an expression into log and execute it
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jul 13 06:10:04 PDT 2014
On Sunday, 13 July 2014 at 12:55:30 UTC, sigod wrote:
> Something like this would be possible if one could get string
> representation of a lazy expression:
> ```
> void _logfx(lazy int expr)
> {
> DebugLog(expr.stringof); // currently it outputs `expr()`
> fx(expr);
> }
> ```
lazy expressions are in fact delegates so this can't work
reliably if there is no access to _logfx source - it has to be
template parameter or language spec adjusted to be more demanding
:(
More information about the Digitalmars-d
mailing list