Anonymous function syntax

Alex_Dovhal alex_dovhal at yahoo.com
Fri Sep 23 00:03:04 PDT 2011


"Robert Jacques" <sandford at jhu.edu> wrote
> What I worry about though is variable hijacking rules. e.g.
>
> auto b = 5;
> reduce!\a+b(map!\a+b([1,2,3,4));

Nice.

What if we extend your proposal to
\(comma_separated_params)simple_expression
\(comma_separated_params){expressions}

Then no variable hijacking would be
 auto b = 5;
 reduce!\(a)a+b(map!\(x)x+b([1,2,3,4));
 reduce!\a+b(map!\a+b([1,2,3,4)); //error, shadowing b 




More information about the Digitalmars-d mailing list