3 ms·
What do you mean by this? Async/await provides a standard way to handle message passing between threads, a cleaner syntax than nested callbacks and a lot of ot
by jayd16 5y ago
What do you mean by this? Async/await provides a standard way to handle message passing between threads, a cleaner syntax than nested callbacks and a lot of other niceties over raw threading.
Async/await is in many single and multi-threaded languages so I'm not clear on what you're saying.
- gpderetta 5y agoIf you are using threads you wouldn't use nested callbacks in the first place. In a proper threaded model you can use exactly the same syntax that you would use with async/await (futures, future combinators, message passing what have you) except you do not have to randomly annotate your code with awaits.
- gorjusborg 5y agoWhat I mean is: async/await is just syntactic sugar over promises/futures and those just buy you a way to schedule future computation. The js runtimes schedule all your code on a single thread. It's the fact your code only runs on a single thread that 'solves concurrency' because data races can't happen if one thread of code is allowed to access memory at a time. You can set up the same limitation in a threaded program/language, and people have (see vert.x, clojure STM, and others).