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

Oliver Hunt oliver at
Tue May 10 16:22:35 PDT 2011

On May 10, 2011, at 4:06 PM, Andrew Dupont wrote:

> To Oliver's point: I think this would qualify as bikeshedding if this didn't really matter. It is a tiny detail, but an important one, so it makes sense that we've spent so long discussing it.
> I acknowledge the arrow notation's advantages over #:
> (a) we've got precious few ASCII characters left and the octothorp has been claimed by several strawmen;
We could kill those strawmen.  /me hides :D

> (b) the proposed octothorp syntax doesn't solve the ->/=> thing (having a concise syntax for binding functions to current scope);
> (c) prior art of CoffeeScript.
I don't consider coffee script to be sufficiently widely used to really consider this a valid use case.  \ is a much more common lambda symbol in many languages, and i'm not sure what the ambiguity would be in \{...} or \(...){...}.

I'm also really not happy with the concept of minor variances in syntax having such dramatic impact the language semantics.  All the fiddling with |this| dramatically increases the complexity of the language, it doesn't simplify it.

> I'm not completely sold on it, though, for a couple of reasons:
> (a) the "cost" of typing an arrow on a western keyboard is much higher than the cost of an octothorp;
I think this kind of "cost" isn't really that important (i seem to deviate from the rest of TC39 in this regard).  The logical progression of this is to replace all "long" keywords with short form characters, thus converting JS code from it's remarkable legibility (Relative to many other scripting languages) into a perl/ruby/APL like monster where people can right "compact" and "elegant" code in such a way as to render it impenetrable to new comers.  (For example it is possible to write reasonable readable perl for people who don't know much perl, but the majority could be used as an alien script in a C-list scifi movie :D )

> (b) the ->/=> distinction is, I think, too subtle. Rebinding dramatically changes the meaning of the function, so I'd prefer if the notation guaranteed that a user couldn't gloss over that by mistaking -> for => or vice/versa.
Agreed.  But of course I don't like any of the messing with |this| binding.


More information about the es-discuss mailing list