3 ms·
What primitives are we discussing? Any Go programmer can and should use the `go` keyword and the `sync.Mutex` type from their first program.
by jeffbee 2mo ago
What primitives are we discussing? Any Go programmer can and should use the `go` keyword and the `sync.Mutex` type from their first program.
- closeparen 2mo agoIt's pretty easy to get yourself into trouble with channels: deadlocks, send on closed, channel leaks, deadlocks "fixed" thoughtlessly with arbitrarily-sized buffers, etc.
- jeffbee 2mo agoThis seems to have little to do with Go's facilities. Any concurrent program has hazards like these.
- closeparen 2mo agoIn my experience, shared memory instills the appropriate fear and caution, while the apparent simplicity of channels encourages novice Go programers to take on concurrency projects beyond their abilities and without due care. Been on both the submitter and reviewer side of that plenty of times in 10 years.
- treyd 2mo agoRust's concurrency libraries leverage the type system to make these issues much harder to encounter.
- jeffbee 2mo agoRust's std::sync::mpsc contains most of the hazards of Go's channel, and arguably adds some because the Go runtime provides deadlock detection that Rust lacks.