logoalt Hacker News

echelontoday at 3:19 PM1 replyview on HN

I write and use mostly async code, and I cannot for the life of me understand the async hate.

What do you want Rust to do differently?

What language does async right?

How did Rust not reach its async goals?

Rust even lets you choose the runtime you want. And most big libraries work with several runtimes.


Replies

mkornaukhovtoday at 4:16 PM

I do write mostly async code, too.

There are several ~~problems~~ subtleties that make usage of Rust async hindered IMHO.

- BoxFuture. It's used almost everywhere. It means there are no chances for heap elision optimization.

- Verbosity. Look at this BoxFuture definition: `BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;`. It's awful. I do understand what's Pin trait, what is Future trait, what's Send, lifetimes and dynamic dispatching. I *have to* know all these not obvious things just to operate with coroutines in my (possibly single threaded!) program =(

- No async drop and async trait in stdlib (fixed not so long ago)

I am *not* a hater of Rust async system. It's a little simpler and less tunable than in C++, but more complex than in Golang. Just I cannot say Rust's async approach is a good enough trade-off while a plethora of the decisions made in the design of the language are closest to the silver bullet.