On Tuesday, 15 March 2016 at 00:29:17 UTC, Stefan Koch wrote:
Hi,

I found myself in need of __trait that might be useful to include.

something that would give me the parameters of a the body of the lambda as string and the parmeters of a lambda as AliasSequence.
e.g
foreach (p;__traits(lambda, (x,y) => x < y)) {
 writeln(p);
}

would output
x
y
x < y

I am sure this is doable unfortunately I lack the insight into DMD to implement this in a reasonable amount of time, and code quality.

Thanks in advance!

Stefan

To get the parameters as as strings, I think this [1] will allow you to that. To get the body as a string, that sounds almost as AST macros :)

[1] https://github.com/D-Programming-Language/dmd/pull/5201

--
/Jacob Carlborg

Reply via email to