On May 25, 2011, at 8:44 AM, Jon Zeppieri wrote:

> On Wed, May 25, 2011 at 11:06 AM, Brendan Eich <[email protected]> wrote:
>> 
>> One last thought: if you want to curry, always parenthesize all calls.
>> Space-separated argument lists just do not look sufficiently "high
>> precedence" when followed by (...) after, to treat
>>   foo {|x| x} (bar)
>> as
>>   foo({|x| x})(bar)
>> instead of
>>   foo({|x| x}, bar)
>> /be
> 
> 
> Agreed. My comment was off-base. I don't expect currying here. I'm
> more worried about the foo({|x| x}(bar)) interpretation.
> 
> That is to say, the different meanings of "(bar)" in
> 
>   {|x| x}(bar)

The new grammar forbids that, though.

You must parenthesize the block-lambda to invoke it with a parenthesized 
argument list:

  ({|x| x})(bar)

Block-lambdas are most commonly used as actual arguments, not as literal 
callees in call expressions. To avoid trouble of the kind Waldemar pointed out, 
they must be caged by parentheses on the outside to be used that way.


> and
>   foo {|x| x}(bar)
> 
> make me wince a bit.

The latter is invoking foo with two arguments, the first (which must be for the 
space-based calling syntax to be legal) a block-lambda.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to