Angus Croll wrote:
Apologies if this is not yet nailed down. I'm looking for the following details re. the arrow function grammar which I was unable to determine from the strawman proposal:

1. Will the syntax support more than an expression in the function body? The proposal appeared to be veering towards expression only syntax - although this could be mitigated by the ES 6 proposed do {} syntax.

The grammar at

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

is clear enough: both expression and braced block body alternatives.

2. Will the grammar allow for implicit returns in the manner of Ruby, CoffeeScript. Seems to be the case for expression bodies.
Only for that case.

If multiple statements are allowed (within block syntax) will implicit return apply to the last statement or does explicit return become necessary?

No, please read the sub-thread starting at

https://mail.mozilla.org/pipermail/es-discuss/2012-March/021879.html

3. Are parenthese required for zero arguments or will
let a = => doThis();
syntax be permitted (in line with CS)

This too is clearly specified by

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

ArrowFormalParameters, second right-part.

Thanks for writing. I take it from twitter you want soft-bound-|this| so a .call or .apply (or new?) can override lexical-this?

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

Reply via email to