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

Kyle Simpson getify at gmail.com
Sat May 7 19:58:32 PDT 2011


>> But, JSConf has just 150-200 JavaScript developers in attendance.
>
> Right. The JS community has no borders, no government, no constitution, no 
> membership cards, no census... We welcome everyone. So we have no way of 
> instituting democratic institutions.
>
>> they are definitely not a representative sampling of the overall 
>> community. Making language decisions based on the vocal support of JSConf 
>> alone is not sufficient.
>
> I can only repeat what I said before. There's no magic way to figure out 
> accurately what most people want. The best we can do is publicize, solicit 
> feedback, discuss, and make a decision. As we have always done.

OK, it's fair to point out that an attempt is being made. I'm asking though 
for the resulting evidence from that attempt. As far as I can tell (and 
please correct me if I'm wrong), there's been a few discussions on some 
rather-esoteric lists/threads, like es-discuss, a few strawmans, and some ad 
hoc presentations as JSConf. If there's a signficant medium of exchange of 
opinions and ideas about topics that I'm NOT listing there, please do tell 
me. I like to think I keep on the pulse of the JS community (generally 
speaking), and so I'm anxious to hear if and how I'm missing out.

If OTOH those few mediums do constitute the breadth of "community opinion 
solicitation" thus far regarding specifically the matters of these 
coffeescript shorthands, as I was previously inclined to believe, then my 
original assertion stands, that this doesn't constitute, in my opinion, 
enough of the broader perspectives on what is and is not useful and readable 
JavaScript. With all due respect, Brendan's personal tastes on what kind of 
code he likes to write is not enough. It has to be something that is likely 
to find wide spread support among the JavaScript masses.

And if we're looking for any kind of guide as to what they might like 
(because we cannot scientifically poll all of them, obviously), then might I 
suggest that the community that's grown up around jQuery (and its associated 
projects, plugin ecosystem, etc) is a place to start. I am not in any way 
suggesting jQuery is the only style of code out there, by any means. But it 
clearly represents a wide swath of how JavaScript developers are currently 
using the language. And jQuery is unique enough in its syntactic 
eccentricities (its chaining, etc) that it may offer some insights.

To the extent that jQuery syntax encourages people to take shortcuts, it 
could be seen as support for shorter syntax. And to the extent that jQuery 
uses lots of anonymous functions, it could be seen as an opportunity to 
shorten all that "function" soup.

But, by the same token, jQuery preserves verbosity in some places for 
readability sake. For instance, event names are known by their full 
canonical names, rather than by some shorthand (similarly with attribute and 
property names). I can say as many times as I write `click(...)` or 
`bind("click"...)`, I could see where `c` or `clk` might be nice to have, to 
save on all that typing. But, it would probably be for a loss of readability 
and semantics of the code.

So there has to be a careful balance struck between shortness and 
readability. I think at least a few of us are saying that we're skeptical 
that -> is sufficiently readable and semantic, compared to function(){} or 
#(){}. The same goes for the loss of `return`... Having `return` in there is 
a good thing, I think, because it makes it clear what's being returned. I 
often write complex functions with internal branching logic, where there's 
more than one `return` statement, and so it scares me to think how I could 
inspect and understand such code as readily/easily if the `return` was 
implicit, for instance, only the last evaluated expression, etc.


>> I was merely responding to Andrew's insinuation that the majority of the 
>> community (including him) had already voiced support for ->.
>
> You have no way of knowing Andrew was insinuating that. I saw only the 
> eminently reasonable point that we will never be able to please everyone, 
> and will have to *try* to please as many people as possible.

Andrew's original message (in part):
> I'd want the committee to listen to all interested parties and try to pick 
> the solution that pleases the most people. That appears to be what's 
> happening here.

The phrase "That appears to be what's happening here", following after the 
"committee...listen...pick" sentence before, led me to believe that Andrew 
was indicating that the movement to adopt Coffeescript-like shorthand was a 
result of the committee *having already listened* and *having already 
picked* a solution that most people agreed with. It was the implication of 
"this has already been happening" I reacted to. If I misread it, I 
apologize. But my interpretation was fueled strongly by half a dozen blog 
posts and dozens of tweets from JSConf and post-JSConf which seemed to 
suggest that this stuff was already basically a done-deal.



>> I take issue with the assertion that shorter==better unequivocally.
>
> I don't know whether anyone actually made that assertion.

>From Brendan earlier in the thread:
> This is shorthand, and only shorthand. And usability counts, so shorthands 
> are in Harmony (e.g., destructuring)

I interpreted that as a pretty definitive "this is a done deal" type of 
statement, similar to the tone I interpreted from Andrew's statement, as 
described above. Again, if I read too far, I apologize, but these are 
exactly the phrases and interpretations which causes me to jump into this 
thread.


> You're reading into perceived "tone" and "insinuation" (your words) things 
> that are directly contradicted by verifiable facts.

I apologize if that's the case. But it sure sounded like it was a decided 
issue (more or less) that Coffeescript shorthands, or something like it, 
would be showing up in a browser near me pretty quickly. I understand that 
Brendan can make such changes in Firefox (I am a Mozilla employee) rather 
quickly ahead of final spec standardizations, and this is probably what he's 
planning (or already) done.

But optimistically putting in a set of shorthands (which some 
forward-thinking devs will immediately start writing against -- especially 
mozilla employees working on Firefox itself) so far in advance of when it's 
really had a chance to settle out in the community and let the community 
"vote" (by virtue of use or non-use) on various syntax changes... that 
carries with it some risk of the tail-wagging-the-dog effect.

So I felt like it was important to voice "early" that not everyone feels 
universally so lovey-dovey over that syntax. In fact, a recent tweet I read 
sums up my feelings: "If I wanted to be using Coffeescript, I'd be using 
Coffeescript. I prefer JavaScript."


> If you want to contribute productively, please assume good faith on the 
> part of your interlocutors. I think you'll find the assumption holds up.

I don't think this is a situation of not assuming good faith. If I thought 
this list acted in bad faith, I wouldn't waste my time here.

I think it's a question of reading (perhaps too far) in between the lines to 
interpolate that a larger (and more fast moving) trend was occurring than 
seemed to be being explicitly disclosed. Again, given all the buzz that came 
out this week after JSConf, to then see this thread and some phrases which 
were suggestive of "it's a done deal", I wondered to myself if there'd been 
some sort of community defining moment at JSConf that I (and millions of 
other devs) had just missed the boat on.

I apologize for my overreactions. And I renew my call that there should be 
more direct solicitation of feedback from the greater community, rather than 
taking what the few of us here on these lists have to say as sufficient.

--Kyle

 



More information about the es-discuss mailing list