Allen's lambda syntax proposal

Eric Suen eric.suen.tech at gmail.com
Wed Dec 3 05:27:34 PST 2008


In feature(ES4), ES may have OptionalParameter, that will cause trouble

{ |a ,b = 1 | c | d | e | f }

is

{ (|a ,b = 1 |) c | d | e | f }

or

{ (|a ,b = 1 | c) | d | e | f }

Regards,

Eric Suen

----- Original Message ----- 
From: "Yuh-Ruey Chen" <maian330 at gmail.com>
To: "Brendan Eich" <brendan at mozilla.com>
Cc: "Eric Suen" <eric.suen.tech at gmail.com>; "Maciej Stachowiak" 
<mjs-2kanFRK1NckAvxtiuMwx3w at public.gmane.org>; "es-discuss" 
<es-discuss at mozilla.org>
Sent: Wednesday, December 03, 2008 8:56 PM
Subject: Re: Allen's lambda syntax proposal


> Brendan Eich wrote:
>> C# uses (a, b, c) => ... but in JS the comma operator makes that nasty
>> to parse top-down. I think the only candidates have to be of the form
>>
>> ^(a, b, c) {...}
>>
>> (^ could be another character, but it seems to beat \ as others have
>> noted), or else the Smalltalky
>>
>> { |a, b, c| ... }
>>
>> At this point we need a bake-off, or a convincing argument against the
>> unusual vertical bar usage.
>
> Here's a possible technical issue that might not apply to ES: Ruby
> blocks params can't have default arguments according to
> http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9#l9 :
>
>    The new syntax allows to specify default values for block arguments,
>    since
>
>     {|a,b=1| ... }
>
>
>    is said to be impossible with Ruby's current LALR(1) parser, built
>    with bison.
>
>
> 




More information about the Es-discuss mailing list