How does a read on a nil channel not panic a Go program?
-
-
Replying to @tqbf
Best answer so far: because select statements rely on nil channel not being ready; correct code might select on nil channel.
@FiloSottile1 reply 0 retweets 3 likes -
Replying to @tqbf
@tqbf@filosottile That doesn't make sense to me. Select could have been written to specially handle nil.1 reply 0 retweets 0 likes -
Replying to @pcwalton
@tqbf@filosottile In fact, nil *is* already handled specially in Go select: https://golang.org/src/runtime/select.go … (selectrecv/selectrecv2)1 reply 0 retweets 1 like -
Replying to @FiloSottile
@filosottile@tqbf Of course, but if you're handling it specially then the semantics of recv are separate from the semantics of select.1 reply 0 retweets 0 likes
Replying to @FiloSottile
@filosottile @tqbf I guess that's consistent, but it's still a footgun :)
10:26 AM - 25 Feb 2016
0 replies
0 retweets
2 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.