How are alts! distinctive?


The chapter 10 video mentions in passing that alts! is a distinctive feature of core.async.

I’d love just a wee bit more color on this. How distinctive? Is it distinctive of core.async as opposed to Java’s concurrency APIs? Or also as opposed to other implementations of CSP-style concurrency, like in golang?

In general I’m curious to understand which aspects of core.async are an expression in Clojure of well-worn ideas, and which parts are more particular to Clojure.


Hey Alexis,

I was referring to Golang’s CSP primarily. In Golang, the alts! equivalent is syntax, whereas in Clojure core.async, it’s a function. Being syntax is ok, but it doesn’t have the flexibility of Clojure’s. For instance, because the vector you pass to alts! is just a regular value, it can change every time through a loop. You can’t do that in Golang since the channels you are taking from are defined syntactically.