Re:Down the Golang Nil Rabbit Hole
by BobbyJo on Tuesday March 30, 2021 @12:47AM
(#26631346)
In practice, those have honestly been the two largest assets to me. No generics means not worrying about a coworker going off the rails and creating a library where it's not needed (me being that coworker often in my past), and clumsy error handling means factoring said error handling into your APIs, making you much more deliberate about where and how errors are eaten. Having used Java extensively, those two 'warts' have honestly saved me a lot of heartache.
[ Parent
| on HN ]
How much do your colleagues (ab)use goto statements that Go provides? :)
C++ has goto, Java has “break <label>“, nobody uses it but you see a lot of generics abuse.
I’ve seen break label a handful of times for nested loops. Whether that was the best choice is of course always up for debate. It’s definitively possible to replace and not a necessary language feature.
Maybe it’s a good thing it’s not widely known, generics are trivial to discover.
What can be classified as generics abuse in Java?
Using generics anywhere only a single type is ever used. The ambiguity really just hurts readability and creates a landmine for future engineers that think other types can be used willy-nilly and things will behave as they should. Especially if some optimizations get done underneath that assume or asserts some set of types, but doesn't enforce them at the API level.
Using java is abusive towards generics, they didn't deserve that?