2011/3/29 Mike Samuel <[email protected]>:
> 2011/3/29 Bob Nystrom <[email protected]>:
>> Wouldn't => work the same way?
>>     (a, b) =>
>> It parses "(a, b)" thinking it's a grouped comma operator (not exactly a
>> common expression FWIW), then it hits "=>" realizes it's a function
>> parameter decl, and then either backtracks or just transforms the left-hand
>> AST into a param decl.
>
> An AST won't cut it.  You have to use a parse tree because there are
> valid grouped comma operators containing only identifier operands that
> are not valid parameter lists, e.g. ((a), b)
>
> Once you do have a way to make the necessary distinctions, => is just
> another right associative operator that you need to pick a precedence
> for.

The fact that there are parameter lists that are not valid grouped
comma operators, () and (a), shouldn't cause problems.

And there shouldn't be any subtle semicolon insertion bugs.

bar = foo
()
=>
4

will reliably produce a syntax error when the parameter list is stolen
by a callable expression on a previous line.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to