Comment by bloppe
4 days ago
Who is "they"? This isn't Rust. It's still up to the developer to follow the advice.
Anyway, I would stop short of saying "Go chose shared memory". They've always been clear that that's plan B.
4 days ago
Who is "they"? This isn't Rust. It's still up to the developer to follow the advice.
Anyway, I would stop short of saying "Go chose shared memory". They've always been clear that that's plan B.
Go's creators said "Don't communicate by sharing memory", but then designed goroutines to do exactly that. It's quite hard to not share memory by accident, actually.
It's not like it's a disaster, but it's certainly inconsistent.
I don't think allowing developers to use their discretion to share state is "certainly inconsistent". Not sure what your threshold is for "quite hard" but it seems pretty low to me.
Goroutines could've lacked shared memory by default, requiring you to explicitly pass in pointers to shared things. That would've significantly encouraged sharing memory by communicating.
The opposite default encourages the opposite behaviour.