Hacker News new | ask | show | jobs
by mattxxx 603 days ago
I've spend a lot of time writing things using async in rust, python, and typescript, and I still find it un-intuitive / conceptually incorrect.

Once you're in an async function the rules then fundamentally change for how everything operates; it's almost like programming within a dialect of the same language. In particular, I'm referring to everything from function calling, managing concurrency, waiting on results, sleeping threads.

Comparatively, when you're in a go-block in go, you're still writing within the same dialect as outside of it.

1 comments

It ultimately amounts to a dialect. It seems confusing because it is a well-supported dialect in each language, which makes you think it is first-class.

The JVM's virtual threads approach is the right way. The runtime should be able to do everything needed to deal with async, and I, the developer, can write simple blocking-style code. Currently there are still issues around pinning when using the older concurrency APIs, but I'm hopeful they can push through them.