(no title)
zazibar | 3 years ago
This entire article is built around the author's ignorance and could easily be summarised as "I avoid async/await syntax because I'm more familiar with promises". The author doesn't even appear to understand that async/await is syntactic sugar for promises.
sidewndr46|3 years ago
saimiam|3 years ago
How would you handle two asynchronous saves which can happen in parallel without using a Promise.all? Don’t think you can…and that’s pretty much the entire point of the article.
Async/await is useless unless you are willing to serialize your calls defeating the entire point of async code.
igemnace|3 years ago
In fact, my immediate intuition with the await examples was to parallelize with Promise.all.
jffry|3 years ago
This question doesn't make sense. Async/await is just a nicer syntax for interacting with promises. So my answer to your "gotcha" question is just:
There's nothing impure going on here. The majority of the time, async/await can make it much easier to see a code's control flow by getting rid of most of the Promise related cruft and callbacks.I would call Promise.all a benefit here, as it makes it stand out where I'm doing something in parallel.
RedShift1|3 years ago
jseban|3 years ago
mpalmer|3 years ago
rwalle|3 years ago
bilater|3 years ago
jrwr|3 years ago
gorjusborg|3 years ago
Learning the event loop, then promises, then async/await is a must. Today, you probably should throw typescript on top.
A steep learning curve just to get back to a typed language that can do things concurrently.
You do get used to it, but it is a mess of stuff.
bdcravens|3 years ago
farmin|3 years ago
Makes using a bit of JavaScript relatively simple, just not much in Stack Exchange yet which means reading docs..
codeflo|3 years ago
snak|3 years ago
imtringued|3 years ago
_ZeD_|3 years ago
the author is conflating parallel with concurrent programming.
and in (the mono-thread world of) javascript the two calls will still occurs sequentially.
gitfan86|3 years ago