Fork me on GitHub
Jakub Holý (HolyJak)10:11:22 Interesting to read about problems with channels in Go. The Clojure implementation seems much better in this regard:) though it shares some of the challenges, such as proper cleanup vs leaking go blocks, the chance of a deadlock

rich 4

I feel like the simple change that core async makes around closing channels makes most of the points in that article moot

💯 4

the reason that it's hard to write the "stop when score reaches 100" toy example in Go is because the go channel api is burdensome (as they mention later in the article)


in core async you can just do (when (> score 100) (close! c)) and everything down the chain just reacts to sending and receiving giving them a nil return value


but in Go, if you are sending to a channel and it closes you get a panic


which is a huge pain to deal with in my admittedly limited experience


and when you get from a cclosed channel in Go it returns the zero value of whateve the channel is


so it's harder, though not impossible, to determine if the channel is closed or if all of the scores you're getting are 0.


but, it's true that people should give the concurrency primitives outside of core async and channels a good look


they're all good stuff