Async is fine
from to on 25 Sep 2023 11:37 +0000

All these posts about async are making the freedom to choose our runtime seem like a bad thing.

For most people, we can just accept Tokio as the de facto standard, and everything is good. Having the other runtimes only makes things better. Don’t do anything weird and it won’t be too much work if you need to change.

Any big change you miss is bound to either be implemented in Tokio or be too different for any abstraction to save you from the work.

If you’re writing a library that you want to be reusable by everyone, I understand your frustration that it’s not easier to make it universal for all async runtimes. You can still choose one, minimize the code you would have to change to implement others, and appreciate that in almost every other programming language you don’t get more than one async engine anyway.

#rust on 25 Sep 2023 12:40 +0000 next

I think this is enviable with low level languages. You simply can’t abstract away as many things. on 25 Sep 2023 14:59 +0000 next

I stopped worrying about this when I had a project with two async runtimes (tokio and bastion) and it worked fine without any special setup. on 25 Sep 2023 15:01 +0000

The way I look at this is I have a reasonable understanding of rust. I’m not an expert but I can more or less do whatever computation I need to do, use crates, and so on. But with async it’s like learning another language. Somewhat of an exaggeration, but it’s not just what code you need to write, but also being able to read the error messages from the compiler, understanding the patterns and so on. So yes, it’s probably fine, but it does take work. on 25 Sep 2023 15:14 +0000 next

Yes, the ergonomics sucks. But to be fair, Rust’s ergonomics kind of suck too, especially when you do anything remotely complicated. Unfortunately, I think that’s just a natural consequence of Rust’s memory safety guarantees.

So yeah, it’s probably fine, and maybe it can’t be much better, but it still kind of sucks to use (esp. if you’re new to it). on 29 Sep 2023 16:21 +0000

It takes work for sure, but admittedly I didn’t find it that much of an undertaking. I’m writing a highly-parallelized 3d game engine with async/await. Am up to a few thousand lines and it’s running very efficiently.

It’s been pretty care-free so far. The biggest pain-point was starting before async traits were stabilized. I think a lack of good instructional material is what has hindered it the most.