Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Docs by

Inside the documentation for core.async, the identifier port is used as an input to some functions/forms. Is port the same as chan? Or is it an interface or a protocol implemented by chan?

1 Answer

+1 vote
selected by
Best answer

A port is the read or write end of a chan. So you can think of most channel instances as having both a read and write port on both ends. In some cases the api may actually give you only a read or write port impl though and not a full chan.

The read and write port protocols are defined at

Thus, any function that takes "a channel" as a parameter, and uses the channel only for reading OR only for writing, could most properly call it a port?
Yes, that’s correct