Hacker News new | ask | show | jobs
by pjmlp 3313 days ago
I fail to see how it is any better than what is available in Java since 1998 (1.2).
1 comments

Go's maps are typed. Java's HashMap (in 1.2) was not.
I wonder if it's okay to state it like that, actually. Java's Hashmaps are typed, in the sense that it's implemented using the type system.

Go maps are an explicit exception in the type system. They have their own type rule. And in the syntax. They have multiple map-specific syntax rules (and not just literals). And in the semantics (e.g. using range on them).

Go doesn't have maps, as such. Go has an inbuilt language feature of one particular type of map, that I assume is thought to be good enough for everybody.

Last time I checked, Object was a type.

But if you prefer, advance a few years up to 2004 (1.5), still 5 years before Go was created.

Also HashMap is just one implementation among all of those that are available in the standard library for the Map interface, each one tailored for a specific use case, with regard to performance and memory constraints.

In Go you cannot change the behaviour of that built in hash map.