You really should see my code (again at playground: 
https://play.golang.org/p/znlLnuT7_lQ). You will see your common sense 
behavior is undesired.
The select statement literally does nothing to check if a channel is nil or 
not and it is a coder's responsibilty to manage if first() is blockable or 
even meant to be blocked.

dc0d於 2017年12月31日星期日 UTC+8下午8時15分04秒寫道:
>
> Thanks leafbebop! Thanks Jan!
>
> I'm not convinced that, this might be a performance problem. Both actions 
> happens anyway, so the total time would be the same. 
>
> Also the function first() may block on it's own. So, the select statement 
> might get blocked on a nil channel! That's bad!
>
> The only reason that comes to my mind for this semantic is that the select 
> statement, might create a barrier of some sort and needs things to be ready 
> before putting up that barrier (I'm not familiar with internals of Go).
>

-- 
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.

Reply via email to