|
|
|
|
|
by parenthephobia
3170 days ago
|
|
But I think I do care. When I see var x = await bar();
I know that other code, outside bar(), may have run during the execution of that statement.Also, the JS approach makes composing asynchronous operations simple: var x = bar();
var y = bar();
return await x, await y;
Both bar invocations can run in parallel. If, say, each invocation of bar fires off an Ajax request that takes a few seconds to come back, that can be a significant saving.It's unclear (to me) how that would be done in Lua without complicating the API. |
|
Also lua-like stackfull coroutines don't prevent firing multiple asynchronous operations at the same time (like in your example), they only make the waiting much more peasant.