r/Clojure • u/cjmurrr • 17h ago
Ten years on: what are go blocks for, now that io-thread runs on virtual threads?
Back in 2016 I asked on Stack Overflow why go blocks return a channel: https://stackoverflow.com/questions/36236869/why-do-core-async-go-blocks-return-a-channel
The accepted answer: use it as a handle, so other code can wait for the go block to finish, or take its result with <!!.
A lot has changed since. In the recent core.async alphas, go blocks were reimplemented on virtual threads, and then that was reverted. What stayed is io-thread running on virtual threads on Java 21+, so blocking I/O there no longer ties up a platform thread.
So, for those on recent core.async and Java 21+:
- When do you still reach for
gorather thanio-thread? - Is the returned channel still how you wait for a result, or do you do something else now?