Big grammatical issues remain unresolved with the expression-bodied short function syntax. For sure.

But ignoring expression bodies, just considering any shorter function syntax that starts with ( params ) ..., we will have trouble reaching consensus in Ecma TC39. To recap a bit:

From http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax

"This cover grammar approach may be future-hostile without, e.g., extending guards <http://wiki.ecmascript.org/doku.php?id=strawman:guards> to be legal in expressions."

We could resolve to allow guards in expressions, and get past this one.

Another lingering objection to arrows is this-binding (=> vs. ->).

Another minor objection is to having arrows + curly braces (vs. alternatives such as block-lambdas). But JS won't have indentation-based blocks, and block-lambdas are incommensurate in some ways with mere shorter function syntax.

/be

Andreas Rossberg wrote:
I'm a little bit confused here. Wasn't arrow syntax "(args) ->  expr"
shot down earlier because it is too difficult to parse for both human
and machine? I don't understand how "(args) expr" can possibly be any
better in this regard. (And I don't believe that a mandatory function
name in front, like suggested by Isaac, makes a difference either
way.)

If we are going for any of this (and I'm all for it!), then the arrow
form seems much more readable (even if -- or rather, because -- it is
2 characters longer).

/Andreas
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to