arrow syntax unnecessary and the idea that "function" is too long

Peter Michaux petermichaux at gmail.com
Fri May 6 17:04:33 PDT 2011


I read Brendan's recent article

http://brendaneich.com/2011/05/my-jsconf-us-presentation/

He asked for community members to make their feelings known and the
es-discuss list as one of the places to do it.

In his article, Brendan shows a slide with the following content

--------------------------
The Harmony goals

  * Be a better language for writing:
    * complex applications
    * libraries (including the DOM) shared by those applications
    * code generators targeting the new edition
  * Better tests, if not a testable (executable) specification
  * Adopt de facto standards where possible
  * Keep versioning as simple and linear as possible
  * Support a statically verifiable, object-capability secure subset
--------------------------

He also discusses the arrow syntax for functions.

If the arrow syntax is only syntactic sugar for the existing function
forms then I don't see how it achieves any of the goals he outlined.
The only possible category is "be a better language" but the arrow
syntax won't make JavaScript a better language for complex
applications or libraries in comparison to any other kind of
JavaScript code. I would argue that the arrow syntax will make
JavaScript a worse language anyway as there are already perfectly good
forms using the "function" keyword now. We don't need new syntax and
we don't need multiple ways to do the same thing just for the sake 6
characters. Please keep JavaScript simple.

Look at all the complex/subtle edge cases mentioned in the wiki page
about arrow function syntax. Do we really want to have that much
trickiness added to the language?

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

Brendan later writes the following as part of the discussion about arrow syntax.

"I’ve been talking about better function syntax for a while. function
is too long (I wish I’d used fn in 1995 and preempted this issue)."

I'd like to ask when is "function" too long? I never type it thanks to
my text editor's features so I know it is not too long for developers
with a good editor. It is not a labor to read the word "function"
either.  It is never sent over the wire because gzip reduces its size
so it is not too long from a performance perspective.

Peter


More information about the es-discuss mailing list