Zig's new plan for asynchronous programs

6 Likes

I found this to be a good writeup. It’s nothing new. It’s the same drum that Loris and Andrew have been beating.

I did find this quote to be a nice insight though.

Later, if asynchronicity proves to be useful for performance, the author can come back and write it using asynchronous operations. If the ultimate user of the function has not enabled asynchronous execution, nothing changes. If they have, though, the function becomes faster transparently — nothing about the function signature or how it interacts with the rest of the code base changes.

6 Likes
3 Likes

I wish these kind of comparison would include Java Loom, which I think is the closest to this, except for the fact that the io parameter is not being passed around. It also completely changes how IO behaves depending on whether you are spawn a real thread, or a virtual thread / fiber / coroutine.