Re:Java 21 makes me like Java again
by segfaltnh on Saturday September 16, 2023 @11:14PM
(#37541167)
Because the predominant patterns are to do concurrency with message passing, so having multiple goroutines trying to mutate the same container is the exceptional case (though as you say, mutexes are the answer when needed). Another reason is containers are embedded features not stdlib, which has huge implications to how willing someone is to go against the grain, for better and worse.
Yet another reason is that you really want generics for container types and Go's generics are relatively new
Ironically, golang does not have constructs to build immutable types to pass them around, while Java does (records).
Re:Java 21 makes me like Java again
by throwaway2037 on Monday September 18, 2023 @05:10AM
(#37553926)
What concurrent data structures that Google Guava offer than the standard library does not?
Not sure about this, but a trajectory question: why does the Go community have so few concurrent containers but Java community does? I mean, even `sync.Map` is specialized for two specific use cases instead of like Java's ConcurrentMap that is of general purpose. And In Java there are concurrent sets, queues, barriers, phasers, fork-join pools, and etc. I'd assume that even with Go's go routines, we can find great use of such containers, right? At least fork-join is not that trivial to implement. And using mutex everywhere seems just so... low level.
I understand that there are 3rd-party implementations, but concurrency is so tricky to get right that I would be really hesitant to adopt a 3rd-party package, unless it is as mature as Java's JCTools or Google Guava, both of which are also backed by a large number of users and developers.