arrow function syntax simplified
waldemar at google.com
Fri Oct 26 21:15:02 UTC 2018
On 10/25/2018 04:04 PM, manuelbarzi wrote:
> The committee has been swamped with numerous such syntax proposals. While any single one may be reasonable in isolation, each one adds significant complexity to the language, and the sum of them is too great (plus multiple proposals try to grab the same syntax for different purposes).
> AFAIS this proposal does not collide with any other one pointing to same syntax.
I've seen informal proposals that do something else with ->.
> Given the existing two syntaxes for defining functions (function and =>), creating a third one would just add complexity.
> would not that "complexity" be worth it, in favor of less bureaucracy and code compression?
> why would just adding a shorthand syntax to functions with thin-arrows would be that "complexity drama"? because people would mix functions and thin-arrows? that's already a reality with code using functions and fat-arrows, and AFAIK nobody complains about it. the only diff here is just to be aware of when to auto-bind (`=>`) or not to auto-bind (`->`). don't see any drama with that.
That's actually the major source of the drama. The difference between => and -> would be subtle enough that it would be hard for casual users to keep track of which is which.
More information about the es-discuss