Fork me on GitHub
#core-async
<
2019-10-16
>
roklenarcic20:10:06

does it matter if channel is left unclosed?

roklenarcic20:10:54

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

hiredman20:10:38

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)

roklenarcic20:10:46

ah but what if I call close! on combinated channel

roklenarcic20:10:53

will it close underlying ones?

hiredman20:10:34

it depends on the combinator

hiredman20:10:54

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

hiredman20:10:35

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

👍 8