zlacker

[parent] [thread] 2 comments
1. crater+(OP)[view] [source] 2023-12-31 07:30:30
The Go folks will repeat the aphorism, "Do not communicate by sharing memory; instead, share memory by communicating."[1]. The author directly violates the intention of the designers of Go by talking about shared file handles and other data structures, i.e. memory.

The word "channel" doesn't appear a single time in the article, even though goroutines without channels to communicate with each other should never be sharing data. Channels are the synchronization primitive in Go.

1. https://go.dev/blog/codelab-share

replies(2): >>bb88+C2 >>jayd16+f3
2. bb88+C2[view] [source] 2023-12-31 08:25:29
>>crater+(OP)
A file descriptor is nothing but a pointer. It's really just an int. Usually maintained by the OS.

Instead of sharing the file descriptor across a goroutine (bro, like WTF), let one go routine manage the file descriptor itself.

3. jayd16+f3[view] [source] 2023-12-31 08:37:10
>>crater+(OP)
Channels would help but the author is saying they're naively shared through a closure and that's a problem, no?
[go to top]