views:

104

answers:

1

What do you think? Will the JVM ever get support for generics?

Quite likely that would not only require substantial changes to the JVM, but also to the class file format, but languages running on the VM would greatly benefit from it.

Edit: The Java language actually supports some sort of generics as a compile time feature, which adds some casts to the bytecode, which people had to add manually before.

The decision to not introduce changes to the JVM or the class file specification was well understood at these times, because they didn't want to break backward-compatibility and Java was the only significant language for the JVM these days.

While this decision might have been appropriate for the Java language, it has significantly reduced the amount of freedom other languages ahve to choose how they want to implement generics on the VM.

Considering that Sun/Oracle have proclaimed to make the JVM a friendlier place for alternative languages, will they actually do what they promised or consider they that the low cost addition of "InvokeDynamic" is enough?

+2  A: 

In my opinion it is unlikely.

It would simply be too disruptive to apply these changes to the Java language. Linguistic and runtime backwards compatibility with two different models of generics would be a nightmare for the designers.

And without, Java to drive changes to the JVM, it is hard to see how Oracle would / could justify doing the work required.

The only possibilities I see are:

  • Oracle decides to develop a successor language to Java (that is not backwards compatible) that does generics, closures and a whole bunch of things better. That would be a really brave business decision, and I don't think Oracle is capable of making it.

  • A bunch of other people / companies get together and fork the JVM specification and the codebase. That's also a brave move to make.

I don't think it is likely that Oracle would resource a major change to the JVM just to support languages that they had no commercial interest in. We are talking about here Oracle ... where the business types have a much tighter control over what the engineering types get to do than in the dying Sun days. (Hey ... we could start a whole Jack Vance theme going here :-)

Stephen C
I wouldn't suggest that they should apply these changes to the Java language. Actually I couldn't care less what happens to Java these days.I'm expecting that Oracle will add these capabilities to the JVM in the future and will abandon their opinion of "if Java doesn't need it, we are not interested".But at the moment, it looks like Oracle is quite happy with Java becoming the new COBOL and the JVM the new "COBOL runner".
soc
But is Oracle actually putting real business effort / resources behind **any** JVM-based language apart from Java? Remember, this is Oracle now ... and Oracle is far more focussed on doing things that will make them money.
Stephen C
No. They are not even putting real business effort behind Java. Currently their actions are little short of pathetic:Closures without function types now (the reason they were originally proposed), the author of the new Date/Time API asking for help because nobody at Oracle seems to care if it gets done in time, many experienced people leaving the company, laughable proposals about primitives in generics and extension (or "defender") methods, etc. .... The whole process looks so amateurish at the moment, it is painful to watch it.
soc
So - why do you imagine that they will change - vis-a-vis JVM enhancements? Have you heard some rumour that they're going to dump Larry Ellison and make Richard Stallman the CEO?
Stephen C