|
|
|
|
|
by first_amendment
3222 days ago
|
|
async/await is nice duct tape to integrate cooperative concurrency into a thread-based concurrency model but it has the drawback of creating an incompatible sub-language for functions within the parent language. Now every time you call a function, you have to check if it is a "coroutine"/ returns a promise or if it's a synchronous function. This divides the language ecosystem and makes it hard for library writers to support both concurrency models. Ask anyone who has done significant async/await coding in C#/Python. It gets messy fast. Async/Await works a little better in JS because it always has had a cooperative concurrency model, standard library functions usually don't block (except sometimes in Node). Though it's still annoying to have to check whether a function returns a promise or not. Languages that do this right are Haskell and Go and probably Elixer/Erlang. This usually requires eschewing LibC (which usually assumes a threaded concurrency model) and writing your own runtime. |
|
> writing your own runtime.
This is not a cost that Rust can bear, and so that option is just not possible. Unfortunately, there's no such thing as a free lunch.