Is it an anti-pattern to implicitly return nil in a go block? If I understand core.async correctly, go blocks create channels that eventually put the return value of the form they wrap. I am also aware that many parts of core.async rely on an assumption that nil taken from channel implies channel is closed. Does this mean the following code is bad?
(go
(try
(do something that will not return nil)
(catch Exception e
(log something with e))))
You cannot actually put a nil value on a channel, so that does not result in a nil value on a channel
What happens in that case is the channel returned is just closed without a value being written to it
Whether that is a problem or not depends on what you are doing with the channel
in my case im simply taking a value from the channel, and I do not expect the channel to remain open after I take any value out of it
Take on an empty closed channel returns nil
This is fine, assuming you don't want to have information about why it failed.