Hacker News new | past | comments | ask | show | jobs | submit login

I never liked promises when they were first introduced because I never perceived this "callback hell" to be an unmanageable problem; there are excellent libraries to manage callback composition, e.g. https://caolan.github.io/async/v3/

When Promises came along I didn't feel they added much value; in fact it made things more complicated (new paradigm, harder to compose).

Still, I went with it because everyone else went with it.

Then async/await came along, I had the same issues as described in the article. Most issues in the article I've made manageable (learning patterns over time, using libraries and/or conventions).

To me the article reads as someone who worked with async/await for some time and never wanted to embrace and work with them in the first place.

I'll be honest; if I'm working in a team with a collegue trying to force all code to use promises instead of async/await I'd probably ask him to stop doing that and escalate depending on the response.

Being idiomatic is very important, it makes code recognizable for newer devs. Had I stuck with callbacks until now I'd be writing code few young JS/TS devs would understand or like to work on.




The semantics of the library you link to seems fairly similar/analogous to promises to me! I'd in fact call promises themselves "an excellent library to manage callback composition", I don't see any reason to prefer the one you link over the promises api -- even if neither were built-in to JS. (And promises of course originally were not).


Your comment is a bit misleading, I doubt you looked for more than 30 seconds at that lib's documentation given the lack of detail in your response.

Just to be clear; I would never use that lib in any circumstance right now, I'd always prefer async/await for idiomatic reasons.

But please have a look at http://caolan.github.io/async/v3/docs.html#controlflow

Forever, queue, series, times, retry, until, waterfall, whilst, etc etc... these are patterns that can all be achieved with promises too but I am sure most devs will do a google search before they do. In fact; some patterns are better served by a library.

Only just yesterday I added https://www.npmjs.com/package/p-limit to get concurrent promise limitation behaviour; one of the many features of that async-lib as well.

Don't misinterpret this as me suggesting these features should be added to the standard; far from it. Community libs do this job quite well.

I moved on from async, I moved on from Promises and embraced async/await.

Do I like it? No, I much rather use Golang's channels. But async/await is idiomatic and plenty of libs out there to handle complex use cases.

Almost everyone has moved on, and anyone writing promises at this moment is just creating legacy for anyone who is going to maintain it. Is that a good reason in itself? No, but it is a very valid one, that is my point.


Same here, I've never had that callback hell problem either, I think it's pretty elegant actually and you can do a lot of nice refactoring by extracting callbacks into variables. And the big strength is that your programming actually looks the way that the runtime works. It just becomes confusing with another abstraction that obfuscates the way the runtime works and requires you to now have this mental translation model.




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

Search: