4 ms·
I had the exact same sentiment when the arrow function was added to JS. My mind has not been changed in the years since. Clear is always better than clever, arr
by irrational 4y ago
I had the exact same sentiment when the arrow function was added to JS. My mind has not been changed in the years since. Clear is always better than clever, arrow functions are not clear (despite the desperate cries to the contrary by complexity loving programmers).
- jraph 4y agoOf all the JS features you are picking the arrow function? Is it the syntax, or the this binding thing that works differently than function expressions / statements you are complaining about? Because the syntax looks somewhat like the function notation in math, and a variation of it is also present in many programming languages, often functional, but also Java since version 8. It's quite widespread and not very bizarre / specific to JS. You'd have mentioned tagged templates [1], I'd have to bow. [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- EdSharkey 4y agoSo that's how test.each works in jest!! Catharsis!
- jraph 4y agoAh, so it's actually used somewhere, and in a widespread tool above all? :-)
- irrational 4y agoThe syntax. I don’t see how prior use in mathematics or other languages has any bearing. JavaScript could have led the way by using a clear syntax instead of perpetuating complexity.
- jraph 4y ago> how prior use in mathematics or other languages has any bearing It counts, because it makes it familiar to many people. Had JS introduced this syntax without it being anywhere else I would be completely with you: it would just be weird and unnecessarily complicated. I find this syntax very clear too (though I still prefer function () { ... } for most functions). It has the merit to make some code using small functions, often somewhat functional, lighter to read. But this is a matter of taste, of course.