New Traits
John Maschmeyer
jmaschme at gmail.com
Thu May 17 14:20:01 PDT 2012
On Thursday, 17 May 2012 at 10:30:26 UTC, Jacob Carlborg wrote:
> Does it work if the lambda is passed to a function:
>
> void foo (int delegate (int x) dg)
> {
> wirteln(__traits(codeof, dg);
> }
>
> foo(x => x + 1);
Unforutnately, no. As written the lambda is a runtime parameter,
so there is no way the trait can get the actual function code.
Instead, all that will print is the signature of the delegate.
If that were a template parameter, it would theoretically be
possible to print the lambda expression, but as currently
implemented it doesn't.
More information about the Digitalmars-d
mailing list