3 ms·
async is final unfortunately. My experience with rust so far is that there is a small set of program structures which Rusts type system works well for, and a l
by lumost 4y ago
async is final unfortunately. My experience with rust so far is that there is a small set of program structures which Rusts type system works well for, and a large set of programs and structures where it becomes an unholy mess to make work e.g. deep lifetime magic, complex async/traits scope, etc.
If you stick on the golden path then the compiler has your back, deviate, and then you are stuck in a deep hell of compiler suggestions that don't pan out. One observation I've had is that complex lifetime problems are usually solved by copy's or the use of unsafe in most production code. I would love to see a future equivalent of "clean code" for Rust, as the current situation is reminiscent of early java programming.
- josephg 4y agoAsync is final, and I think the design is fine. The problem is that async code doesn't interact properly with the rest of the rust language. You can't make async traits, async iterators or streams, or use async closures. The problem isn't async. Its that the rest of the language is apparently (still!) incompatible with async code. All of this stuff is "coming" - and by that I mean, there have been RFCs kicking around since 2017 aiming to fix these problems. Blergh. Eg: GATs: https://github.com/rust-lang/rust/issues/44265 https://github.com/rust-lang/rust/issues/44265 (This one might land soon!) Async closures: https://github.com/rust-lang/rust/issues/62290 https://github.com/rust-lang/rust/issues/62290 (seems to have stalled) TAIT: https://github.com/rust-lang/rust/issues/63063 https://github.com/rust-lang/rust/issues/63063 (seems to have stalled) And so on.
- maleldil 4y ago> async is final unfortunately This is wrong. Async traits and iterators will be huge improvements to the language, and there is more in progress. Can you provide examples of copy/unsafe being required for complex problems?