block-lambda revival

Mike Samuel mikesamuel at gmail.com
Thu Jun 23 19:04:04 PDT 2011


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; }


More information about the es-discuss mailing list