Hacker News new | ask | show | jobs
by ackfoobar 1494 days ago
At first I misread "wider" and agreed.

In Go/Kotlin, one can atomically take from/send to exactly one channel with the `select` call.

Then I agree with "weirder" as well, in the case of Go channels. A send on a nil channel blocks forever. Why?

1 comments

Haha yep, it's those edge cases, to quote one of the many web pages documenting it:

  Channels exhibit the following properties:

    * send to a nil channel blocks forever
    * receive from a nil channel blocks forever
    * send to a closed channel panics
    * receive from a closed channel returns the zero value immediately
I have this bookmarked because I don't write Go enough to remember it by heart.