Hacker News new | ask | show | jobs
by Twey 1 day ago
> What is harder to find is the bridge between them, the part that connects understanding how async works to actually shipping with it.

There is actually already a tutorial at this level: Tokio has its ‘async in depth’ tutorial [1] that walks you through building a toy runtime and using it to run a future.

Not a complaint — you can never have too many tutorials, unless they're about monads — but just a pointer in case you hadn't seen it :)

[1]: https://tokio.rs/tokio/tutorial/async

1 comments

Ah what a great little tutorial. Thanks for sharing that one.

It looks like rust async creates state machines similar to how Kotlin does it with so-called Continuations.

Yes I really think it should be better advertised!

The continuation model is the standard model of async programming and still perhaps the nicest semantically. Rust's big innovation is that futures are polled from the top, i.e. (potentially) advanced in an idempotent way whenever any of their relevant resources progresses, which is nicer for resource-conscious programming because it doesn't require that you capture the stack. It adds complexity over the continuation model from the programmer's point of view, but opens up async programming to a wider range of contexts in a way that is genuinely novel.