Re: Would it be possible to add “await on first use” to the language?

Šime Vidas sime.vidas at
Fri Feb 24 18:42:27 UTC 2017

Yes, I think you nailed it. I didn’t make the connection before. Instead of
awaiting upfront, forcing the async operations to run in sequence, the
awaits are ‘moved’ to the variables themselves, allowing the async ops to
run in parallel (as much as possible), and once one such variable is used
(in any form), the async function makes sure to pause execution in order to
wait for the value to resolve.

As I’ve said elsewhere in this thread, we would get optimal concurrency
without having to micromanage the promises.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list