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

Erik Corry erik.corry at gmail.com
Sun May 8 13:37:48 PDT 2011


On May 8, 2011 8:34 PM, "Irakli Gozalishvili" <rfobic at gmail.com> wrote:
>
> I'm really happy that arrow syntax proposal was made and thanks a lot
Brendan!!
>
> I'd like to point out that coffeescript has a huge success and in the end
it's just syntax sugared js. I think this is quite good proof that syntax
change like this is more then welcome.

To me the success of coffeescript is that it shows that those who want to do
experiments with JS syntax don't have to burden the web platform with their
language extensions in all perpetuity. Those who want the new syntax can
have it now without waiting 5 years for IE10 to die. And if CoffeeScript
turns out to be a terrible mistake then everyone who cares can stop using it
and, poof, it's gone, unlike __proto__, with, eval scope modification, ==
etc.

Saying that CoffeeScript shows we should be making fundamental changes to JS
syntax feels to me like arguing that the success of JRuby shows Java should
look like Ruby.

Having a C-like syntax is IMHO a strength for JS. We could add a shorter
version of 'function', and in 5 year's time we can even start using it on
the web. But messing fundamentally with the syntax risks ending with
something that is very hard to parse by programmers used to C-like
languages.  It's not like we can remove the old syntax so every new piece of
syntax is additional in terms if what has to be grokked by every programmer,
IDE, syntax highlighter, verifier and VM.

Personally, I'd like to argue against the idea that JS is a good place to
experiment with language design. I think JS is far too important and hard to
iterate for that.

>
> Another thing I'd like to point out that arrow function is not just saving
keystrokes of typing `function` and `return`, but also gives even bigger win
IMO via `=>` when binding of `this` pseudo variable is desired. This case
BTW was not addressed by `#`. Even though `->` is one more char in
comparison to `#`,  `=>` is much less then `.bind(this)`, in addition having
both -> and => feels just natural!
>
> Regards
> --
> Irakli Gozalishvili
> Web: http://www.jeditoolkit.com/
> Address: 29 Rue Saint-Georges, 75009 Paris, France
>
> On Sunday, 2011-05-08 at 19:09 , Rick Waldron wrote:
>>
>> Just read
https://mail.mozilla.org/pipermail/es-discuss/2008-November/008218.html and
I'm buzzing with the idea of Lisp style functions as "inspiration" for a
short hand. While I realize the idea is likely absurd, but I'm thinking in
terms of concepts that _all_ JavaScript devs know and understand.
>>
>> This is a super simple, first-pass, rough-draft, not-too-serious,
request-for-comments...
>>
>> https://gist.github.com/961495
>>
>> Rick
>>
>>
>>
>> On Sun, May 8, 2011 at 1:51 PM, Faisal Vali <faisalv at gmail.com> wrote:
>>>
>>> On Sun, May 8, 2011 at 4:04 AM, Jorge <jorge at jorgechamorro.com> wrote:
>>> > On 08/05/2011, at 05:52, Faisal Vali wrote:
>>> >
>>> >> (...) I find the
>>> >> aesthetics of the arrow-syntax far more consistent with javascript's
>>> >> C-based-syntactic roots than the preprocessor-tainted '#' (...)
>>> >
>>> > Consistent ?
>>> >
>>> > -> in C has a *totally* different meaning !
>>>
>>> Yes, but that is why I alluded to a syntactic commonality and not a
>>> semantic one.
>>>  But, I can see how the disparity in semantics might bother some
programmers.
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110508/65d2fa67/attachment.html>


More information about the es-discuss mailing list