4 ms·
I'm not a java guy but having to deal with type conversion in Go isn't auto-boxing a good thing ?
by aikah 11y ago
I'm not a java guy but having to deal with type conversion in Go isn't auto-boxing a good thing ?
- mmastrac 11y agoWhoever 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.
- mcculley 11y agoIn 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.