5 ms·
async, when looked at from the "writing code" perspective is horrible. it pollutes every function with async annotation. it allows you to quickly write the co
by knuthsat 5y ago
async, when looked at from the "writing code" perspective is horrible.
it pollutes every function with async annotation.
it allows you to quickly write the code imperatively by just annotating a function and using the async function inside it.
it results in code that is massively polluted with async when at most places you never had to use it at all (if you just restructured the code).
having async be as verbose as possible would enforce people to not use it as much and to structure their code to have async bits nicely separated from non-async bits.
- sitkack 5y agoThat would be a kind of a sintax, no?
- knuthsat 5y agoI guess it depends on what OP is talking about. Async code can be written with callbacks (callback hell incoming), or with Futures/Promises, or with syntax sugar like async (do notation). Whatever the reason is for using async, I believe that the mismatch happens not because Async is optimized for I/O bound programs but because it's insanely easy to use (in Rust, Javascript).