Thursday, March 11, 2004

Re: C++ Generics

have you guys heard of a language called eiffel?

Yeah I've heard of it. But don't know much about it. Why dyou ask?

i have hardly read stuff on artima. but they seem very design oriented. you recommend any more articles?

That site is very good. They don't have articles per se... they mostly have interviews with the "big" guys in programming. They have a series going with C# designer Anders Hejlsberg, Java designer James Gosling as well as C++ designer Bjarne Stroustrup and many more. Those tell you about what their goals were when they were designing the languages.

also bill veneers, the creator of artima (i think) has this great book on java internals, the bytecode spec

There is a link on artima... Is this what you're referring to?

he too came up with examples on auto_ptr and tupples.

Take a look at the STL documentation... Pretty much everything on there is totally generic.

It seems it might have been a better idea for them to make changes to the bytecode and metadata to make this happen.

could you explain what u meant.

If they make changes to the bytecode or the metadata, the JVM will have to be updated to be able to handle it. To avoid this update (or to keep backwards compatibility), they chose NOT to do this. Instead, it's the same code (with casts), but done by the compiler.

So I was saying, they should have changed the bytecode and emited some more metadata to handle generics. This way, those casts would be eliminated. The metadata would hold the generic class template as well as info about the type the class was instantiated with at runtime.

No comments: