Syntax question about inlined functions/delegates/lambdas

Maxim Fomin maxim at maxim-fomin.ru
Mon Dec 30 11:14:45 PST 2013


On Monday, 30 December 2013 at 19:00:49 UTC, Gordon wrote:
> So I've learned that syntaxes in cases 2,4,6 are wrong, but 
> they still compile.
> May question is - what do they do? what usage do they have 
> (since they do not trigger a compilation warning)?
>
> Thanks,
>  -gordon

You could notice that syntaxes 2,4,6 are "=>{" which means that 
what follows next is return value, not body of function, i.e they 
don't do what is expected but return delegates which do what is 
expected. You need to wrap them into ()() to make them work.

By the way, strictly speaking they are template lambdas.


More information about the Digitalmars-d mailing list