Allen's lambda syntax proposal

Brendan Eich brendan at
Thu Dec 4 11:34:17 PST 2008

On Dec 4, 2008, at 10:28 AM, Maciej Stachowiak wrote:

> On Dec 4, 2008, at 7:18 AM, Michael wrote:
>> Would this form also be ambiguous and/or too difficult to parse?
>> {=> 9*9}()
>> {a => a+b}(12)
>> {(a,b) => a+b}(12,6)
> I imagine it would be problematic for a top-down parser because you  
> may have to parse an unbounded number of characters to determine if  
> the initial parameter list is in fact a parameter list or a comma  
> expression.

Right -- especially if one includes destructuring parameters.  
Typically a top-down cover grammar is parsed, and then disamiguated  
based on right context after the AST is built, with any adjustments to  
the AST encoding made retrospectively. This can get ugly.

Worse, as Waldemar pointed out, you can end up with a failure to  
backtrack and find the valid sentential form that a bottom up parser  
would find via shifting and reducing.

Combined, this says to me that the C# syntax is no-go for JS.


More information about the Es-discuss mailing list