Hacker News new | ask | show | jobs
by frou_dh 4543 days ago
The commentary in the channel one is a bit off. With size 1+ it's a buffered channel and as such you could do what's shown in a single goroutine without blocking:

    package main

    func main() {
        c := make(chan bool, 1)
        c <- true
        println(<-c)
    }
It'd be unbuffered if there were no holding space, i.e. make(chan bool, 0) or simply make(chan bool)†. Cool project though - subscribed.

---

† Yes, built-in functions get not only generics privilege, but overloading too. It's evidently not as pitchfork-worthy.