Proposal: paren-free function calls and definitions

Brendan Eich brendan at mozilla.com
Sun Jun 19 16:04:36 PDT 2011


On Jun 19, 2011, at 3:17 PM, Claus Reinke wrote:

> https://github.com/clausreinke/jstr/tree/master/es-discuss
> 
> You can find there the proposal text, with motivation, grammar changes, semantics (entirely via desugaring to existing syntax), and related issues, as well as a prototype implementation, using jstr's nascent grammar-based ES-to-ES rewriting:
> 
>   tailnests.txt: proposal text


Quick reply to point out that:
    FunctionExpression :
      function Identifier_opt ( FormalParameterList_opt ) { FunctionBody }
+     function Identifier_opt ( FormalParameterList_opt ) => AssignmentExpression

inverts precedence, as MemberExpression : FunctionExpression but now FunctionExpression can end with a low-precedence expression (AssignmentExpression).

For example, the last line in

  function f(x) => x;
  z = a + function (b) => b ? f : x++(1);

parses awkwardly, as ( z = ( a + ( function (b) => ( b ? f : ( x ++ ) ) ) (1) ) ).

/be


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110619/7c50e086/attachment.html>


More information about the es-discuss mailing list