3 ms·
Lua coroutines don't have that ability out of the box. JavaScript promises do (Promise.all).
by SomeCallMeTim 10y ago
Lua coroutines don't have that ability out of the box.
JavaScript promises do (Promise.all).
- deleted 10y ago[deleted]
- anonymoushn 10y agoThis is an interesting characterization of the situation! I can save the 20 LOC involved in implementing this if I just give up the ability to write my own event loops and pepper my code with a bunch of additional "await"s every time I add an asynchronous operation to a function used by other functions.
- unscaled 10y agoYou can also implement your own event loops with promises, but it's a matter of tradeoffs again: You can't control the way functions written by someone else will schedule their internal continuations - you can only control the way you schedule your own continuation. I'm not sure if Javascript gives you a lot of control there, but C# allows you to define your own TaskScheduler and specify it on ContinueWith.