News for hackers. Stuff that matters.
Re:Oracle cooks up free and premium JVMs by melling on Saturday November 06, 2010 @11:50AM (#1877100)
This is really bad idea. Java and the JVM can still be greatly improved. Closures, fixing generics, tail call optimization, module system, faster startup, etc.

JavaFX will be a nice improvement once it's integrated with Java.

Re:Oracle cooks up free and premium JVMs by narrator on Saturday November 06, 2010 @12:36PM (#1877210)
Yeah but unless Google buys Oracle or wins the Dalvik lawsuit and implements a better server side JVM than Oracle, I just don't see how it can happen. Closures work fine in Scala, BTW.
Re:Oracle cooks up free and premium JVMs by fauigerzigerk on Saturday November 06, 2010 @03:04PM (#1877496)
Google cannot buy Oracle but maybe they can buy Java. But even the latter possiblity has become much less likely with the premium JVM announcement. Apparently Oracle is determined to monetize Java.
Re:Oracle cooks up free and premium JVMs by sukuriant on Saturday November 06, 2010 @12:21PM (#1877175)
Hitting a couple of your points: What about Generics is broken? For the extent of power they seem to intend to provide (forcing methods to only take a particular type, and providing syntactic sugar so you don't have to cast everywhere.

Tail-call optimization is just that, an optimization. A 1.6 compliant, open-source JVM could provide that. Same with the faster startup time.

As I don't generally use closures, and would replicate their abilities through interfaces and anonymous classes, I don't have a comment on them; and you'd need to expound upon "module system" for me to say anything.

Re:Oracle cooks up free and premium JVMs by crux_ on Saturday November 06, 2010 @01:37PM (#1877327)
What's wrong with java generics: erasure. "Cast everywhere" is still happening. And useful info is hidden: eg there is no access to generic type info via reflection. Another wrong thing: generics are incompatible with subtyping. (No co/contra-variance, to use the pointy headed terms)

Tail call optimization is not a mere optimization. A jvm cannot provide it and still provide conforming exception stack traces, for example.

As far as closures: you're missing out :)

Re:Oracle cooks up free and premium JVMs by dantheman on Saturday November 06, 2010 @01:47PM (#1877351)
Also tail call optimization changes the semantics of the language - it allows you to write code that would normally be incorrect
Re:Oracle cooks up free and premium JVMs by crux_ on Saturday November 06, 2010 @02:17PM (#1877408)
True, although you have to be careful about "incorrect": the code will still compile (unless there's some corner case I'm missing?), so for that particular definition of correctness it is just fine without TCO.

It just won't run (for very long). :)

Re:Oracle cooks up free and premium JVMs by dantheman on Sunday November 07, 2010 @05:24PM (#1880531)
I agree, but compilation is a low barrier for correctness :)
Re:Oracle cooks up free and premium JVMs by mkross on Saturday November 06, 2010 @05:42PM (#1877834)
Wait, generics support co/contra variance through the 'extends' and 'super' keywords. e.g. Collection<? extends Foo>
Re:Oracle cooks up free and premium JVMs by crux_ on Saturday November 06, 2010 @07:21PM (#1878044)
I suppose so; but not in the sense I was thinking of: a Collection<Firetruck> is not a subclass of Collection<IVehicle> (and it is impossible for you to create your own generic class where this type of relationship would be true).
Re:Oracle cooks up free and premium JVMs by mkross on Saturday November 06, 2010 @08:20PM (#1878176)
While Collection<Firetruck> has an indeterminate relationship with Collection<IVehicle>, this is good! If Collection<String> was a subclass of Collection<Object>, you could fill the collection with Strings and then pass it off to someone who is using it for Objects and adds in his own Integer. Now your collection is borked. :(

If you find yourself wanting to pass in Collection<Firetruck> to a method that only accepts Collection<IVehicle>, this usually means that the method isn't correctly typed. The rule of thumb for using 'super' and 'extends' is "Producer extends, Consumer super" or PECS. By applying this, the typing problem should go away, as your method is now accepting Collection<T extends IVehicle> and possibly returning Collection<? super T>, so you can both pass in your Collection<Firetruck> and reassign to a different variable of type Collection<Firetruck>. :)

(I think Josh Bloch wrote up a decent blog post about the PECS principle a couple of years ago. It might be worth reading for more information.)

Re:Oracle cooks up free and premium JVMs by crux_ on Saturday November 06, 2010 @10:53PM (#1878491)
As I enjoy the benefits of immutable data structures and read-only interfaces, it is absolutely not an unmitigated good. Replace "Collection" with "Iterator" above, and the borking you mention is impossible ...
Re:Oracle cooks up free and premium JVMs by sukuriant on Saturday November 06, 2010 @04:11PM (#1877657)
Would it be that impossible to keep a counter of what iteration of function X the user is on? Or, does tail recursion also count things like:

int A() { return 1 + B(); }

int B() { return 1 + A(); }

(with necessary ending conditions)

Re:Oracle cooks up free and premium JVMs by crux_ on Saturday November 06, 2010 @04:33PM (#1877699)
Yes, tail call optimizations include mutually recursive functions.

Note that your example was not of tail calls, however. (Tail call would be: return A(...); that is, a tail call is one whose result is immediately returned.)

Re:Oracle cooks up free and premium JVMs by sukuriant on Saturday November 06, 2010 @07:09PM (#1878005)
That does become harder to follow, then.

And, woops...

Re:Oracle cooks up free and premium JVMs by steveklabnik on Saturday November 06, 2010 @01:31PM (#1877315)
> What about Generics is broken?

I'm going to be slightly handwavy, so forgive me: Generics are implemented by doing type erasure[1] rather than as 'real generics' through some other method. This causes issues with runtime reflection.

> would replicate their abilities through interfaces and anonymous classes,

This embodies exactly what I hate about Java: In other languages, where I simply 'do/end' or ' \ ->', I have to create a whole giant pile of boilerplate bullshit to pull off something that's supposed to be easy.

1: http://en.wikipedia.org/wiki/Generics_in_Java#Type_erasure

Re:Oracle cooks up free and premium JVMs by sukuriant on Saturday November 06, 2010 @02:02PM (#1877384)
On Generics: I did not know they performed that slight-of-hand, internally. That does make them rather weak.

On Java-bloat: to be fair, it's really not that much, especially if it's already a known interface: new TreeSet<Foo>(new Comparator<Foo>() { public void compare(Foo a, Foo b) { mycode(); } });

However, your point stands. I've just come to accept that as being a part of Java, myself.

Re:Oracle cooks up free and premium JVMs by quicksilver03 on Sunday November 07, 2010 @11:36AM (#1879660)
The only thing that I would fix in Java Generics is the syntax, the use of angle brackets is what makes me reject the whole implementation.