# Thursday, September 5, 2002
« No Title | Main | No Title »
No Title


Yesterday, Microsoft Research released a beta version of Gyro, which is their implementation of generics for Rotor.

I downloaded it this morning and played with it, and I must say, it's great! This is going to be the killer feature for .NET (once the commercial platform gets it). Unlike the platform that starts with a J, this is actually done right. The Java generics proposal that was floated for 1.4 and then withdrawn was an ugly (nay, disgusting) hack. Gyro is beautiful, I have no other word for it.

I can't wait for this to appear in the commercial platform!

Thursday, September 5, 2002 6:43:29 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [3]
Thursday, September 5, 2002 10:30:13 AM (W. Europe Daylight Time, UTC+02:00)

Which proposal for Java was that?

I only know of the proposal by Odersky and Wadler who experimented with the Pizza and GJ
java extensions. I liked that very much. It seemed like a clean extension of java
(the language) only array support was a little bit hacked I believe. One drawback was
that it was based on the existing byte code representation because they wanted to be
backward compatible with old systems but it seemed like it was easy to implement cleanly
if you wanted to break with old byte code (which is reasonable for gcj for example since
that already compiles to native code anyway).

How is this generics extension better than that proposed by Oderski and Wadler?

Friday, September 6, 2002 1:47:52 PM (W. Europe Daylight Time, UTC+02:00)

The jsr is available at http://www.jcp.org/jsr/detail/14.jsp

A few things that are wrong with it:
- it breaks static type safety
- inefficient
- no runtime type information (generics are based on erasure)
- no support for value types

Gyro has none of these limitations.

Friday, September 6, 2002 9:56:30 AM (W. Europe Daylight Time, UTC+02:00)

I had a little email exchange with Jeroen about this (in Dutch)
that I like to summarise.
(Jeroen will surely correct my if this is not how he sees it.)

We agree that java byte code is far from ideal to represent generic types
(and to represent non-java object oriented languages in general).
CIL is much nicer especially with the generics extension proposed in the paper
that Jeroen referenced. But since the authors admit that this extension is still
not powerful enough to model the (higher-order) types used in Mercury or Haskell
I don't think this will be the be all/end all of type/byte code systems.
(Which reminds me that I have to check out Parrot <http://www.parrotcode.org/>.)

On a java byte code level Jeroen is right that you lose type safety and efficiency.
But Wadler and Odersky do propose a way to add the type information to a class file
(you will have to add support in the VM and compiler to actually read it). But I think
on the Java programming language level the Generic Types proposal is very nice and
if you ignore java byte code it can certainly be implemented type safe and efficient.
(Although Jeroen told be about boxing/unboxing of primitive (and user defined) types,
which would be very nice to have.)

For people wanting to know more about Generic Java:

Comments are closed.