Fork me on GitHub
#core-async
<
2016-01-21
>
wei01:01:29

reading the docs (https://clojure.github.io/core.async/), what’s the difference between a port and a channel? what’s the difference between >! and onto-chan?

Alex Miller (Clojure team)13:01:08

A port is either the read or write end of a channel. A basic chan typically has a read port and a write port.

Alex Miller (Clojure team)13:01:53

onto-chan puts a collection of values onto a channel instead of just one

erik_price14:01:16

A lot of the core.async API uses the parameter name port where the parameter should be a channel

erik_price14:01:25

or at least, it used to (haven’t checked in a while)

wei22:01:33

thanks for the clarification @alexmiller. also I’d agree with @erik_price that when listing parameters it would be less confusing to say channel. e.g. (<! channel)

Alex Miller (Clojure team)23:01:27

It was unclear when we released async whether port and channel would diverge as concepts. They still might. It's particularly interesting to consider cases that need read or write ports but not both.