3 ms·
Could you explain a bit more about how you see Golang improving this? For me, Go is trickier to use concurrently than Rust, and requires keeping track of more
by tene 5y ago
Could you explain a bit more about how you see Golang improving this?
For me, Go is trickier to use concurrently than Rust, and requires keeping track of more details you need to manage yourself without compiler assistance or checking.
For example, the default data structures like Map are not thread-safe, but you'll only discover that you've used a Map from multiple threads without synchronization when you actually have a concurrent modification at runtime, which might not show up at low load during testing.
You're also responsible for explicitly locking (and unlocking) any synchronization primitives before accessing a synchronized resource, and ensuring you don't hold any references to synchronized data past the unlock.
With Rust, this is all encoded in the APIs, and verified by either the type checker or the borrow checker.
Since I need to deal with Golang at work, I've been trying to get less frustrated with it, so I'm really interested in hearing perspectives about what people appreciate about Golang, or what it does right or does well.
- jstimpfle 5y agoI've never used Golang myself, but their mantra is "share data by communicating, instead of communicating by sharing data". This "communicating" is batteries-included through Golang's channels.
- dcow 5y agoIn practice, in my experience at least, pure channel implementations are rare. It's rather hard to do (although I'll admit that was one of the most fun things for me about Go: "how can I solve this problem purely using channels?"). Sadly much Go code is far from the mantra. I've even heard seasoned Go programmers pass along the "wisdom" if you're using channels you're doing it wrong" (implying you haven't built the correct abstraction). Most Go I've encountered sadly uses shared memory and waitgroups and run_once. I think there are performance reasons for this too or something "channels are slow".