We went over this in the thread Isaac started. You'd need a [no LineTerminator
here] between ) and {, and then the syntax looks too much like a juxtaposed
parenthesized expression and block.
The latter problem, a lack of syntactic distinctiveness, also felled there
entry mooted {(x)x} block-lambda alternative syntax.
/be
On Mar 27, 2012, at 5:22 PM, Russell Leggett <[email protected]> wrote:
> On Tue, Mar 27, 2012 at 3:43 PM, Brendan Eich <[email protected]> wrote:
> http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax
>
> Use => only with an expression body (do-expressions if accepted allow
> statements and combined with => compete with block-lambdas).
>
> Use -> only with body block, as for long-form function.
>
> Just a thought - if a block is required on the RHS of the ->, why not just
> skip the arrow? I could be mistaken, but would it be just as easy
> grammatically to do:
>
> array.forEach((v, i) { if (i & 1) oddArray[i >>> 1] = v; });
>
> instead of:
>
> array.forEach((v, i) -> { if (i & 1) oddArray[i >>> 1] = v; });
>
> This way, there would only be one kind of arrow. Without an arrow its
> basically just removing the keyword function, and therefore maybe a little
> bit easier to transition. With the arrow added, you can expect a bigger jump
> in semantics.
>
> - Russ
>
>
>
> I deferred other accretions.
>
> In a rush here, comments and corrections welcome and I'll edit as I can.
>
> /be
> _______________________________________________
> 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