var map = function (f) {
return function (list) {
return list.map(f);
};
};
and const map = f => list => list.map(f);ES6 has template strings, destructuring assignment, Map and Set data structures (and more). While you're right and it is not NEEDED, this is something that dramatically improves on the weakest aspects of ECMASscript.
Based on your comment, it feels like no addition is ever a good addition if you can express it with the building bricks you already have. With such a way of seeing things, we'd all be coding with assembly language, cause nothing really affects speed or memory consumption for the better.
Why it is a big deal one might ask. It is the BIGGEST deal in history of Javascript in my book because it allows you to do async that looks sync. No more callback hell. It is the single most important feature, as it eliminates async issues completely. And EVERYTHING in js is async. But in reality, you want to drop into async only sometimes. Now you are forced into it 100% time, even when you need the result of async call to decide what to do next. It gets tricky really fast.
The whole thing is, when some IO returns 1 or 2. And your next step is to do a or b depending on the reply. How is your neat promise chain looking now? Then repeat 100 times :(
Not even mentioning error handling... and stack traces.
So i do agree that it depends what you do a lot. Maybe there are domains where it is not important... but i still need to see that one.
And i will take blocking IO with try/catch 10 times out of 10. Even when it is not critical. It is just nicer and easier to reason about.
Promises + Generators = The sweet spot.
Check out https://www.npmjs.com/package/coroutiner to make it stupid-easy to coroutine your entire app.
There are other advantages to yield as well. Entire design patterns like CSP aren't possible without it.
Because as soon as you might have "toString" or "__proto__" as a key things go all haywire.