22 ms·
The real problem here is that Go does not allow a user to create their own powerful concurrency primitives. Locks exist, but you can't create a synchronized da
by TheDong 11y ago
The real problem here is that Go does not allow a user to create their own powerful concurrency primitives.
Locks exist, but you can't create a synchronized data structure. You can't create your own channel type because that's a generic thing which is reserved for the language authors, not the language users.
The whole point of modern programming is to create useful abstractions that allow a programmer to get things done without having to worry as much, and concurrency-related abstractions like parallel map-reduce and actors are powerful, but you have zero chance of making an abstraction for that in Go.
In Go it's basically CSP or bust; saying "you can use locks" is not an answer; locks are not a way to handle concurrency, they're a primitive for shooting yourself in the foot if you're unfortunate to be in a language where you can't abstract them away suitably.
- nickbauman 11y agoI wish I could upvote this +1000
- fixermark 11y agoI'm not sure what stops someone from creating their own channel types. type MyChannelType chan MyStruct ?