arrow function syntax simplified

manuelbarzi manuelbarzi at
Thu Oct 25 23:04:47 UTC 2018

> 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. it's just one more push on same direction to the initial proposal
(already linked before). plus adding the PROPOSAL 2 for named functions:

function applyFactor(value) {
return GLOBAL_FACTOR * value

// PROPOSAL 2 - named function declaration (without 'function' keyword):
// applyFactor(value) -> GLOBAL_FACTOR * value

> You will not be able to deprecate `function`, as that's just not
> web-compatible.

"deprecation" could be progressive while keeping back-compat and
encouraging users to switch to shorthand syntax of functions (and named
functions) by means of thin-arrows. there's no intention to abruptly break

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list