|
|
|
|
|
by matharmin
3215 days ago
|
|
I work with fairly large JavaScript codebases, and the issues mentioned in the post has never been an issue for me. The switch from callbacks to Promises, and later to async-await has made a massive improvement to the ease of writing, reading and maintaining the code. Lazy and cancellable tasks are edge-cases that don't need support in Promises directly. I haven't needed either of those in more than a couple of places in the code, versus thousands of places where Promises are used as is. I can see the automatic unwrapping of Promises to be an issue in some libraries that want to make specific guarantees, but in most of my code this has behaviour has simplified things. I definitely prefer having Promises and async-await right now over another theoretically sound (but probably more verbose) system available in a couple of years. |
|
I however write a lot of systems where almost all operations need to be concurrent, cancelable and rate-limited.
Personally I find callbacks and the event loop easy to reason about, but too daunting when all you do is CRUD requests to a database.
The problem with Promises though is that they spread, they don't like to live side by side with other async paradigms.