Setting a list of values

sigod via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 7 09:29:28 PDT 2016


On Monday, 2 May 2016 at 23:41:39 UTC, Steven Schveighoffer wrote:
> On 5/2/16 6:00 PM, sigod wrote:
>> 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.
>
> Agree.
>
> -Steve

https://issues.dlang.org/show_bug.cgi?id=16001


More information about the Digitalmars-d-learn mailing list