[quote]What you want is the generics stuff, and a JRE/VM that will optimise for this. Ie you use a HashMap that is compile time constrained to only use int’s for the keys and/or values. At runtime the JRE or VM can then substitute in an int optimised HashMap instead of the default one.
[/quote]
Yes, we need type-specific instantiations of parameterized classes - just like you’d get in C++ or PolyJ. No, we don’t need to be delaying the generation of those classes until runtime. That’s just a pure waste of compute power.
[quote]However, I don’t think primatives can be specified for generics - ie would have to be Integer object not int.
[/quote]
No, in the current implementation of JSR14 we can’t use primitives for type parameters. Yes, in a good implementation of parametric genericity we can. Look at PolyJ. http://pmg.lcs.mit.edu/polyj/
Sun’s complaint with Poly was that it wasn’t as backwards compatible as GJ was. My suggestion to Sun is that they use a mixed-style strategy then. Continue to use type-erasure for instantiations with reference type parameters, where compatibility is actually an issue. Use heterogeneous or PolyJ-style translation for instantiations with primitive type parameters, where compatibility isn’t an issue.
Then, everybody would get what they need.
God bless,
-Toby Reyelts