Of Generics and Erasure and, of all things, GC and memory layout

I'm trying to grok the difference in generics implementation between Java and C++, specifically the implications of type erasure in Java.

Most of the info I'm finding is blogger stuff, so I'm wondering if there's any better-than-most analysis of the issue out there.

This issue also makes me wonder about the impact of having to store type info along with data - a required "vtable pointer" in C# lingo if I get that right - on some traditional memory layout schemes.

Does this put an end to BIBOP like value typing schemes, if many small words are type parameterized? Box[T], Pair[T,U] and so on???

Or how about the two word Cons cell tricks (via distinguished non-Cons object header word) vs. List[T] where one needs a vtable word in every Cons cell along with head/tail (car/cdr whatever), which with 2 word alignment is going to make for big fat 4 word cons cells?

Inquiring minds want to know :-)


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

A Practical Analysis

Angelika Langer has an excellent Java generics FAQ - hardly LtU style but quite readable. And she has a strong C++ background, so she's likely to describe things in a way you'd appreciate: Here's the FAQ.

Java Precisely

I've heard good things about Peter Sestoft's Java Precisely, which includes a discussion of generics.

Previously on LtU

A brief discussion about different strategies here: Generic types