On Fri, May 5, 2017 at 1:35 PM, Ronald <yunthana...@gmail.com> wrote: > > So the question: > > Isn't it better just to throw a panic when user send/recv on a nil > channel instead of forever blocking it? If not, what is the benefits?
There is value in the ability to have a select case be a nil channel. In a select a nil channel is never ready to receive and thus isn't a case that will proceed. This is useful for allowing you to conditionally prevent certain cases from proceeding by swapping out the channel for a nil. While outside a select this behaviour isn't really useful, but for consistency it works exactly the same. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.