4 ms·
This may be an unpopular opinion, but I disagree. Arrow functions are unnecessary syntactic sugar, and, like much of ES6, feel like the language adding opiniona
by arbie 8y ago
This may be an unpopular opinion, but I disagree. Arrow functions are unnecessary syntactic sugar, and, like much of ES6, feel like the language adding opinionation.
Enterprise codebases I work on are locked to ES5 and scale to 100k+ lines. These codebases cannot afford to layer on every new JS "innovation" and hope to remain consistent across 7+ years (the average lifespan of an enterprise app) and multiple developers.
To assume that this is just because of developer laziness or inability to learn is to ignore the realities of apps built and deployed behind the firewalls of Fortune 500 companies.
- wishinghand 8y ago> Arrow functions are unnecessary syntactic sugar Unnecessary is a matter of taste. Most don't like having to bring out `.bind()` or inside of the function using `let that = this`.
- sieabahlpark 8y agoWhoever thinks it's easier to understand the this scope because they have to explicitly declare it must just like to not learn better methods to program. const that = this;
- johnfn 8y agoIt’s pretty well accepted by this point that normal functions in JS get a lot wrong. Inconsistent creation styles, weird hoisting rules - and lets not forget the fact that they don’t bind this, which itself is probably one of the top ways to cause a bug in vanilla JS. Each of these are great ways to trip up developers in JS, both amateur and expert. Arrow functions fix them all. I’m not saying that your 100k loc code bases can’t be built without them. Obviously, once a language is turing complete, then everything is possible. But certain language features tend themselves to create bugs at a higher rate than others because they confound the expectations of even the most experienced developers. Functions are such a feature. I’m sure your 100k code bass works fine now - but I wonder, if you look through the commit logs, just how many bugs were caused by some of the inconsistencies and strangeness I mentioned above, and I wonder how much of that time and those bugs could have been obviated had you moved. Probably a decent amount.
- tinus_hn 8y agoJust because you are locked into the enterprise troglodyte mindset doesn’t mean the rest of the world has to remain living in the past.
- dang 8y agoPersonal attacks will get you banned here. Please don't post like this to HN. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html