4 ms·
You never "have" to await at the call site. There's very little stopping you from: fFuture = getAsync(); // do other things f = await fFuture; Most impl
by WorldMaker 3y ago
You never "have" to await at the call site. There's very little stopping you from:
fFuture = getAsync();
// do other things
f = await fFuture;
Most implementations of async/await Future/Task/Promise often have some sort of `all` combinator to multi-join as soon as all results arrive, even:
fFuture = getFAsync();
gFuture = getGAsync();
hFuture = getHAsync();
// other stuff
(f, g, h) = await all(fFuture, gFuture, hFuture);
The syntax makes it really easy to do the simple step-by-step await at every call site, but it also doesn't stop you from writing more complex things. (Sometimes very much more complex things when you get into combinators like `all` and `race`.)
- tsimionescu 3y agoOh, yes, I didn't think to mention that since I was focused on showing what pattern the syntax makes easiest.