2 ms·
> This is how Java used to work, circa 2004. This part of Java actually wasn't so bad. I would argue that Java didn't get better with the addition of generics
by mseepgood 11y ago
> This is how Java used to work, circa 2004.
This part of Java actually wasn't so bad. I would argue that Java didn't get better with the addition of generics in 1.5.
- AdieuToLogic 11y agoI believe Mr. Yager's point was not so much about Java generics as it was that determining the type of a container's contents was impossible without manual type checking. I am not he so take that with a grain of salt. What makes opaque containers a particular form of debug hell is when working in a non-trivial code base. Lobotomizing the one assistant which never tires (the compiler) puts the onus on people to "just know" what is in there (for whatever definition of "there" is at the moment). Call me cynical, but people are horrible at keeping these kinds of concerns straight.
- mseepgood 11y agoThe built-in types slice and map are type-safe and cover 90% of container needs. If you want to use a non-builtin container such as container/heap and you find yourself casting too often, write one or two little wrapper functions for your use case, which encapsulate your casts. This is also an opportunity to make the wrapper represent the problem domain better.