I actually listened to a fresh interview with Brendan Eich yesterday, where he said that the keyword function he chose when he was prototyping JavaScript turned out to be a bit on the longish side for the JavaScript parser, which negatively affected its speed; so when the video mentioned the shortcut for the function keyword, it sounded a little too real.
Well you can't really reuse arrow functions unless you put it into an object. Also it always binds this...there are some scenarios where this arguably isn't wanted
Probably because other languages that have the same arrow function syntax (C#, Hack) don't have one. Yes yes, I know that CoffeeScript does.
That and the use cases are very narrow. There's not really a reason to complicate the syntax if it's not necessary. If you really want to maintain this, you can just use regular function syntax.
Honestly the main thing that annoys me about it is it makes the language totally inconsistent. If you want this binding you use () => but if you don't you use function()? Those are completely different. It makes me feel like I am using some patchwork language (which I am).
25
u/azangru Apr 01 '17
I actually listened to a fresh interview with Brendan Eich yesterday, where he said that the keyword
functionhe chose when he was prototyping JavaScript turned out to be a bit on the longish side for the JavaScript parser, which negatively affected its speed; so when the video mentioned the shortcut for thefunctionkeyword, it sounded a little too real.