News for hackers. Stuff that matters.
Re:I Avoid Async/Await by xigoi on Saturday April 16, 2022 @08:45AM (#31051863)
I don't think we disagree. JavaScript should've gone with do notation precisely because it's a generalization of async/await.
Re:I Avoid Async/Await by valenterry on Saturday April 16, 2022 @08:51AM (#31051909)
From the perspective of someone wanting to use the powerful do-notation, sure. But at the same time, the hurdle for many developers who just want to "use promises with ease", it would have been a steeper learning curve with much less beginner-friendly syntax.

do-notation doesn't really help to deal with promises, it even makes it harder because it is confusing at the beginning. Async/await makes using promises easier and hides problems for some time at least. I can see why they chose to use async/await.

Just to give an example: error handling with try/catch. That doesn't work with do-notation, but with async/await you can integrate it (more or less at least) and it looks like sync code.