Re:Updating the Go Memory Model
by chakkepolja on Monday July 12, 2021 @12:24PM
(#27811916)
Correct me if I am wrong, isn't a channel basically same as blocking queues in Java? I know go but not much advanced.
[ Parent
| on HN ]
Seems like there are a few differences but nothing I personally would leave normal indexing, kind of working generics, Maven and a choice of 3 world class IDEs behind for: https://stackoverflow.com/questions/10690403/go-channel-vs-j...
To each their own though. I hear a lot of people prefer it.
More or less, but with the ability to "poison" them by closing which causes downstream go-routines to exit. You can do the same thing in java by checking for a poison object and then terminate your loop.
The close is built into the language itself which is useful, along with the other built in language functionality. I wrote about it here, with an example of how to do it https://boyter.org/posts/file-read-challange/
Re:Updating the Go Memory Model
by chakkepolja on Monday July 12, 2021 @10:24PM
(#27817105)
Thanks!
Re:Updating the Go Memory Model
by clipradiowallet on Monday July 12, 2021 @04:50PM
(#27814956)
I don't code Java, but I have the same sentiment about channels in golang to queue's in python.