4 ms·
I feel the same way, it's a lot like `const` in C++. Basically it's enforcing usage for every upstream user to ensure there's no inefficiency (such as waiting
by brrrrrm 4y ago
I feel the same way, it's a lot like `const` in C++. Basically it's enforcing usage for every upstream user to ensure there's no inefficiency (such as waiting for things like the network).
JavaScript has an extremely nice "out" (I'm sure other languages do too):
async function() {
await async_thing()
do_sync_stuff()
}
can be written
function() {
async_thing().then(do_sync_stuff)
}
which is quite intuitive and helps glue code together. I think the callback-based thinking really clarifies user intent ("just tell me when it's done") without impacting performance.
- gpderetta 4y agoproblem is async doesn't enforce anything. You can still block from an async function.