Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, but if you write a few thousand of those arrow functions, you will hate the useless function (a) { return b; } stuff, too.


If you're writing a few thousand functions, you're doing something very wrong.

It's like when languages make threads easy to create - and then programmers go away and use threads for everything!

Maybe some verbosity is a good thing because it makes programmers think about whether they really want to do something a few thousand times.


Javascript is a functional language. You _should_ be writing many functions, possibly thousands in a large codebase.


Javascript has first-class functions and anonymous functions, but so do lots of imperative languages, and there are plenty of other reasons to see Javascript as an imperative language. The reason we end up writing many anonymous functions is because we are using interfaces like foo.map(...) instead of interfaces like for-loops which take a block as a body (because Javascript for-loops are unbearably clumsy, e.g. iterating over properties instead of elements).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: