- You can't name the type of a impl Future.
- They play terribly with the borrow checker because the borrow checker can't handle self referential types.
- There's no future executor in the standard library. You need 3rd party libraries. And the most common library is tokio, which is a whale.
- Despite all the work, there's still no async streams in the language.
- Pin. !Unpin. pin_project. Unsafe pin_project. What are we even doing.
But async works really well in javascript. Maybe where we disagree is that I don't think any of these issues are because async itself is a bad idea. But, async has become the place dreams go to die in rust. Look at the issues above. They're all problems with rust's type system, borrow checker and standard library.
What I think rust needs is:
- A way to have self-borrows in a struct. Types with self borrows would be implicitly pinned.
- A way to name the return value of a function. Eg let x: ReturnType<some_func>. People have been saying this is right around the corner since 2019.
- Generators. Futures are built on top of generators inside the compiler. But generators have - for some reason - never been exposed in stable rust. I think generators should have been stabilised first - since all the problems you need to solve to make generators work well (self referential types, return values you can name, etc) are things futures need too.
Unfortunately I think that ship has sailed too. I try to avoid async rust whenever I can. Its such a pity. I'm hoping someone makes a rust 2.0 language at some point which fixes this situation.