4 ms·
Interesting! For comparison, Haskell went with the library approach but has the syntactic sugar of the equivalent of `and_then` built into the language. (I am
by eru 6y ago
Interesting!
For comparison, Haskell went with the library approach but has the syntactic sugar of the equivalent of `and_then` built into the language. (I am talking about Monads and do-notation.)
It's a bit like iterating in Python: for-loops are a convenient syntactic sugar to something that can be provided by a library.
- newpavlov 6y agoYes, a number of people have suggested introduction of a general do notation (or its analog) instead of usecase-specific async/awayt syntax, but since Rust does not have proper higher kinded types (and some Rust developers say it never will), such proposals have been deemed impractical.
- pdpi 6y agoIt’s not just HKTs. Figuring out how to handle Fn, FnOnce, FnMut is a whole other can of worms.
- smt1 6y agoI think there were some (related, I think!) proposals here: https://github.com/rust-lang/lang-team/issues/23 https://github.com/rust-lang/lang-team/issues/23 https://github.com/rust-lang/rfcs/issues/3000 https://github.com/rust-lang/rfcs/issues/3000
- steveklabnik 6y agoIt is a little old, but for the general gist of it, http://aturon.github.io/tech/2018/04/24/async-borrowing/ http://aturon.github.io/tech/2018/04/24/async-borrowing/ is an amazing description of the problem here. It is a PhD level research problem to know if monads and do notation would be able to work in Rust. The people who are most qualified to look into it (incidentally: a lot of the same crew was who was working on async) believe that it may literally be impossible.
- anp 6y agoMy impression is that some of them even burnt out in slog of a supposedly rushed process to land async/await!
- deleted 6y ago[deleted]