core-async

roklenarcic 2019-10-16T20:26:06.006200Z

does it matter if channel is left unclosed?

roklenarcic 2019-10-16T20:26:54.007200Z

if I close a derived channel (one created by async/merge or async/reduce does it close underlying channel? Does any of this matter?

2019-10-16T20:31:38.008100Z

it depends, the channels returned by the combinators that come with core.async generally close the channel when they are done with them, so you don't need to (not always, read the docstrings)

roklenarcic 2019-10-16T20:38:46.008500Z

ah but what if I call close! on combinated channel

roklenarcic 2019-10-16T20:38:53.008700Z

will it close underlying ones?

2019-10-16T20:46:34.009700Z

it depends on the combinator

2019-10-16T20:46:54.010100Z

some no, some yes, some take a close? argument

2019-10-16T20:48:35.011700Z

channels are not a global resource, so closing them isn't required for them to be garbage collected or whatever, but because channels are often used for communication between different parts of a program it is good practice to close them to signal to whoever is at the other end that you are no longer sending or receiving

👍 2