3 ms·
Promises in the JS world have lost out to async[1]. The callback pyramid madness has been traded for a simple and flat waterfall[2]. The constant .then and .c
by ihsw 11y ago
Promises in the JS world have lost out to async[1].
The callback pyramid madness has been traded for a simple and flat waterfall[2].
The constant .then and .catch when working with promises naturally makes a lot of people uncomfortable, and on top of that the async library provides a plethora of other collection manipulation and control flow utilities.
Frankly I think managing side effects should be abstracted away, and furthermore I cannot wait for C#-like async/await to become first-class citizens in the JS world.
[1] https://www.npmjs.com/package/async https://www.npmjs.com/package/async
[2] https://www.npmjs.com/package/async#waterfall https://www.npmjs.com/package/async#waterfall
- fiatjaf 11y agoAre you sure promises have lost to async? This is a crazy statement.
- agumonkey 11y agoI have no data, but ES7 plans to support async/await, and Python 3.5 just shipped with it. I find it a strong signal already.
- aikah 11y ago> I have no data, but ES7 plans to support async/await, and Python 3.5 just shipped with it. I find it a strong signal already. we're mixing up 2 different things here, the async package and the C# like async/await feature native to javascript. The async package while popular is certainly not more popular than promises.
- lemevi 11y ago> I find it a strong signal already. Well cancel your signal because native browser APIs are returning promises: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia https://developer.mozilla.org/en-US/docs/Web/API/MediaDevice...
- agumonkey 11y agoConfusing mixed signals then.
- phpnode 11y agoasync/await is powered by promises, it's crazy to say that promises are going away, they're becoming an even more fundamental construct in the language.
- aikah 11y ago> Promises in the JS world have lost out to async[1]. What (js) planet are you living on ? async package certainly has it's place, but the fact that promises are object you can pass around make them more useful than any async package. > Frankly I think managing side effects should be abstracted away, and furthermore I cannot wait for C#-like async/await to become first-class citizens in the JS world. Well too bad, because async/await will work with promises. And I quote the blogpost : > In practice, returning side effects rather than performing them and returning promises can increase the size of the “functional core” of your application, which is a win in my book. Which is exactly what I'm saying.
- notNow 11y agoWell too bad, because async/await will work with promises. and promises are built on callbacks at the lower level. I just don't really get these callback-intolerant people's averse reaction towards this construct when it's literally all over the place and those new abstractions are there to conceal them which is a good idea by the way but not to extinguish them completely as they might hope or believe.