core.async discourages you from placing nil in a channel, as nil is only
taken when the channel has been closed. However, if I create a go block
with a body that evaluates to nil, core.async will return a channel that
contains nil. This is a nil as a take! value, not a nil to indicate the
Sounds like a bug to me. A nil value in return position of a go block
should probably close the channel.
On Saturday, December 14, 2013 2:18:07 PM UTC-5, Stephen Cagle wrote:
core.async discourages you from placing nil in a channel, as nil is only
taken when the channel has been closed.
How do you know where the nil is coming from? Channels never accept nil, so
any nil you get from a take is due to the channel bing closed. And yes,
returning nil from a go causes the go's channel to close without a put.
Timothy
On Sat, Dec 14, 2013 at 4:35 PM, Brandon Bloom
Huh, that is pretty clever.
You're right, I just assumed I was seeing the body result. That is a pretty
clever way to fix the issue. nil just closes the returned channel, causing
future takes on it to return nil. Neat.
On Saturday, December 14, 2013 11:18:07 AM UTC-8, Stephen Cagle wrote: