Setting a list of values

sigod via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 2 15:00:01 PDT 2016


On Monday, 2 May 2016 at 10:15:04 UTC, Marc Schütz wrote:
> On Monday, 2 May 2016 at 08:46:31 UTC, Ali Çehreli wrote:
>> [...]
>
> Warning (better: disallowing altogether) about `=>` directly 
> followed by `{` should be enough to cover all cases. To express 
> that you really want a lambda returning a lambda, it can be 
> rewritten either as:
>
>     (x) => () { assert(x); }
>
> or as:
>
>     (x) => ({ assert(x); })
>
> This check can be done purely by looking at the tokens. Should 
> we someday introduce tuples with `{}`, the check needs to be 
> done after the node starting with `{` has been parsed to 
> distinguish between delegate and tuple literals.

It's good idea. I myself stumbled into this before.


More information about the Digitalmars-d-learn mailing list