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

Breton Slivka zen at zenpsycho.com
Tue May 10 15:42:10 PDT 2011


I have to say that I was a bit indifferent about the different
syntaxes on offer until I had a good look at the strawman, and found
that there were differences between -> => and #(x)->(x*x); with
regards to |this| binding. I have to admit that at the moment, exactly
what those subtleties are, is a little over my head at the moment.

But given I have to explain |this| again
http://stackoverflow.com/questions/1085674/where-is-my-this-using-objects-method-as-a-callback-function/1085715#1085715
and again
http://stackoverflow.com/questions/5639451/why-this-is-not-this/5692094#5692094
and again...

I appreciate efforts to address the |this| problem. I think though,
that in terms of familiarity, "bind" already effectively solves that
specific issue. The  # operator seems too much like ambient magic to
me.

Broadly, I like how the arrow syntax resembles mathematical notation
for "functional dependency", much like the original function syntax
resembles mathematical notation for "function". Given some time, I
don't think it would be hard to get used to. But it might scare some
programmers easily spooked by "weird" syntax.  We're the experts, the
language designers (you), and the advanced users (me and others), who
are drawn to and appreciate javascript due to its resemblance to
scheme and haskell etc. etc. so the arrow syntax appeals to us on that
level. But one of the strengths of Javascript has been as a
syntactical trojan horse- Getting these nice qualities under the noses
of people who would otherwise find that stuff unpalatable. For this
reason, as much as I like arrow syntax, and attempts to address |this|
scoping, I have to lean towards #(x){x*x}, and us syntactical snobs
can still have coffeescript.

I still wish there was a way to make |this| less confusing though. I'm
sure you do too.
-Breton


More information about the es-discuss mailing list