arrow function syntax simplified

Luke Hoban lukeh at
Tue Mar 27 14:08:46 PDT 2012

Great to see the arrow syntax proposal moving forward. 

I think I missed a step though in the reasoning for moving to this proposal vs. the previous arrow proposal.  What problem did the previous proposal have that is addressed with the new proposal?

There's a couple concerns I have with complexity added in the new version of this proposal:

1) => and -> look similar, but have multiple points of difference.  Both what is allowed on the RHS and also binding of 'this'.  That will likely make this harder to explain and harder to reason about code on quick inspection.

2) This version seems to more or less rely on 'do expressions' to make the => form fully usable, which are more of a departure from current JS than arrow syntax itself.  What was the reason to disallow statement bodies on the RHS of =>?


-----Original Message-----
From: es-discuss-bounces at [mailto:es-discuss-bounces at] On Behalf Of Brendan Eich
Sent: Tuesday, March 27, 2012 12:44 PM
To: es-discuss
Subject: arrow function syntax simplified

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.

I deferred other accretions.

In a rush here, comments and corrections welcome and I'll edit as I can.

es-discuss mailing list
es-discuss at

More information about the es-discuss mailing list