Fork me on GitHub
#core-async
<
2019-11-10
>
Jakub Holý (HolyJak)10:11:22

https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad/ 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
markmarkmark15:11:46

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

💯 4
markmarkmark15:11:27

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)

markmarkmark15:11:19

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

markmarkmark15:11:32

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

markmarkmark15:11:46

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

markmarkmark15:11:05

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

markmarkmark15:11:44

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.

markmarkmark15:11:30

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

markmarkmark15:11:33

they're all good stuff