Re:Java autoboxing/unboxing madness (2007)
by aikah on Thursday September 03, 2015 @12:41PM
(#10165920)
I'm not a java guy but having to deal with type conversion in Go isn't auto-boxing a good thing ?
[ Parent
| on HN ]
Re:Java autoboxing/unboxing madness (2007)
by mcculley on Thursday September 03, 2015 @01:26PM
(#10166260)
In general, it is good. But when combined with generics, weird stuff happens. Say you have some generic collection of Integer (e.g., Map<Integer, String>) and you retrieve some autoboxed value that was coerced into a Long and you try to use that as a key. You might get a null result where you would expect otherwise. It makes you want to pull your hair out and undermines the confidence that type safety gives you in general.
Autoboxing and generics are clearly bolted onto Java and it would be designed differently if they were there in the beginning. This makes me doubtful when Go adherents say that they can just add generics later.
Re:Java autoboxing/unboxing madness (2007)
by mmastrac on Thursday September 03, 2015 @12:44PM
(#10165941)
Whoever wrote this obviously wasn't around for the pre-boxing Java experience. Want to store a list of ints? Box on the way in, box on the way out.
So. Much. Typing. I'll take the occasional "gotcha" that's not terribly difficult to diagnose or fix over the world we had before.