6 ms·
I think the new arrow functions are neat, but am I the only one who never really found it a hassle to throw a .bind(this) on a function?
by AnkhMorporkian 12y ago
I think the new arrow functions are neat, but am I the only one who never really found it a hassle to throw a .bind(this) on a function?
- bshimmin 12y agoAside from the fact that your "never" somewhat dismisses the first however many years of web development (up to IE9) when `Function.prototype.bind` couldn't universally be expected to be supported, surely having a nice piece of syntax which is both shorter than writing out `function` and serves the purpose of binding the function in the way that, a good majority of the time, you actually want it bound, is a good thing? As someone who's spent a lot of time writing CoffeeScript, I think ES6's fat arrows are a great thing, though I have my usual concerns about their confusing the hell out of people who may well have been writing JavaScript for a long time but in environments where they don't necessarily get exposed to new and exciting stuff. But hey, that's progress, I guess.
- acjohnson55 12y agoI agree. Fat arrow is a massive improvement. Not just for its extremely logical handling of "this", which 95% of the time is the behavior I want, but also because it eliminates a massive amount of syntax noise when programming functionally.
- AnkhMorporkian 12y agoSure, my .bind was a little insensitive to those who had to suffer through ES3, but honestly I thought we were pretty much ignoring the 90s.
- bshimmin 12y agoYou say "the 90s", I say "2011". Potayto, potahto!
- jschrf 12y agoNot supported in ES3, IIRC.
- ulisesrmzroche 12y agoI think it adds too much line noise, especially if people start nesting callbacks.