block-lambda revival

Brendan Eich brendan at mozilla.com
Thu Jun 23 19:56:29 PDT 2011


On Jun 23, 2011, at 7:04 PM, Mike Samuel wrote:

> 2011/6/23 Brendan Eich <brendan at mozilla.com>:
>> On Jun 23, 2011, at 4:07 PM, Rob Campbell wrote:
>> 
>>> I'm liking the block-lambda syntax, I think more than the arrow. One
>>> possible shortening could be to exclude the second bar (|) if no argument
>>> variables are specified.
>>> {| // some block of code };
> 
>> This does not work. How do you know that what follows the first | is not a
>> formal parameter?
>> Formal parameter syntax looks like expression syntax -- currently Expression
>> covers FormalParameterList. Arrow function syntax relies on this.
>> /be
> 
> Are you thinking that
> 
>   {| a | a }
> 
> it is ambiguous whether
> 
>    function (a) { return a; }
> 
> or
> 
>    function () { return a | a; }


Precisely.

/be


More information about the es-discuss mailing list