Live data from Hacker News

Java 9 with GPU processing, Java 10 will be all-OOP without primitives

javaworld.com

81–90 of 138 posts

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#81
post #20

Earlier quoted context omitted.

Why don't they start now and build Java 2.0 from ground up instead of Java 10 for 2017? That would be way faster and they learned so much by now to make a great successor. Who wants a Java 1.x in 2040?

Because they learned from netscape's mistake, that's why. http://www.joelonsoftware.com/articles/fog0000000069.html

The netscape rewrite became Firefox.

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#82
post #39

Earlier quoted context omitted.

Because they learned from netscape's mistake, that's why. http://www.joelonsoftware.com/articles/fog0000000069.html

"You are wasting an outlandish amount of money writing code that already exists." On the contrary, there has been a number of times that I've completely rewritten some code to use a framework or library that was already battle-tested and more fully-featured than the previous effort. I ended up saving myself from writing code that already exists.

Right, but you're one person and you're redoing the plumbing.

At this point oracle can't rewrite Java. If they don't support the current programs, nobody would use it, if they do, they will really be rewriting code that already exists.

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#83

Earlier quoted context omitted.

Well, actually, in C# struct instances ARE objects allocated on the stack, instead of the heap. A parallel can be drawn with C++ in which the user of a class decides on declaration/initialization where to store the object (either on the stack, or on the heap). The difference with C++ is that in C# the author of the class decides where instances of it should be stored, so this decision happens when the class is declar…

> Well, actually, in C# struct instances ARE objects allocated on the stack, instead of the heap. You have it backwards, they're not value types because they're allocated on the stack, structs are allocated on the stack because they're value types. See Eric Lippert's article "The Stack is an Implementation Detail": http://blogs.msdn.com/b/ericlippert/archive/2009/04/27/the-s...

So no, I don't have it backwards.

Also Eric Lippert nails it when he answers the question of why reference types are not stack allocated and value types are ... “because they can”.

I do agree with the article, but with all due respect to Eric Lippert, C#/.NET was meant to be reasonably fast for all kinds of user-land applications and if structs weren't added, then they had to add special cases (primitives) for dealing with integer and floating point arithmetic, just as Java did.

I do agree that structs have semantic value, but the implementation itself allows the available primitives to be described in terms of structs, which is a really elegant and cost-effective solution to a problem that the JVM engineers are trying to solve with complicated tricks like escape analysis. If you remove the performance/efficiency benefit, there isn't a lot of value left in structs - at least nothing that can't be solved by immutable data-structures and/or a better type system.

Nice article btw, thanks.

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#84

Earlier quoted context omitted.

The "boxed primitive" types (Integer and so on) should be `final`. This means no inheriting from them, which means no polymorphism, which means their sizes and all operations on them are known statically. This means you can store them as values in the object with no fuss, and you can inline all of their access functions.

Java objects have functionality beyond dispatch tables. Synchronization is one. You can also have x != y where x and y are different objects with the same value.

For integers, implementations are allowed to have unique instances for every value (and must have unique ones for some small values). A conforming implementation can extend that to 'all integers' (It might break existing programs, but such programs would not be standard conforming).

I do not know whether the standard currently allows for code that is guaranteed to produce Double's with equal values that are not object.Equal to each other, but I doubt that making that impossible will introduce many problems.

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#85
post #3

Wow, how can you seriously plan releases of a programming language out to 2021? That is an eternity in this industry. Even 2015 for JDK 9 seems mighty far off, especially accounting for the usual slippage of release dates with big software projects.

> Wow, how can you seriously plan releases of a programming language out to 2021? "A plan is useless, but planning is essential" [1] More true than ever, if you ask me. Sure, you make plans, why wouldn't you? But you also retain the flexibility to adapt the plan as the environment changes. You don't chisel the damn plan into a stack of stone tablets and render it immutable for all time. I don't see any conflict whats…

Exactly, there is nothing wrong with long range planning. Planning this far out allows you LOTS of time to iterate on your plans, making them better.

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#86
post #41
post #25

The presentation declares, "Java is not the new Cobol." It shocks me that a major company like Oracle would be so foolish as to make a statement like this. Stating that something is not is one of the most effective ways to imply that it is and the speaker knows it.

Freud somewhere talks about a primitive tribe where the punishment for saying "The king is not an ass" is the same as for saying "The king is an ass". Edit: I remember reading this years ago and have been unable to track it down. Would love it if somebody did.

Probably in Totem and Taboo? This concept is expressed in a number of his books, however.

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#87

It seems to me that eliminating primitives could be a really bad idea. If you have a class: public class CompoundObject { int i; int j; double k; } This class's data members are all a few bytes away from each other, so once the object is loaded into the CPU cache, all operations should be fast. With boxed types, you might get 3 cache misses when accessing i,j,k. On the other hand, referential transparency can help he…

You don't need to use a uniform field representation, and the representation in the object doesn't need to match the representation on the stack/in registers.

For example Dylan language doesn't have primitives as such. The d2c compiler passes objects around as a two-element struct containing a type tag and a value (in practice values get passed around in a pair of registers). Now, if you have a field with the declaration , and you store a in there, then the field will consist of two words: a type tag and the double itself. However, if the field is declared as a , then the field will be stored as just the double, and the field accessor code will add the (constant) type tag as the field is read.

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#88

It seems to me that eliminating primitives could be a really bad idea. If you have a class: public class CompoundObject { int i; int j; double k; } This class's data members are all a few bytes away from each other, so once the object is loaded into the CPU cache, all operations should be fast. With boxed types, you might get 3 cache misses when accessing i,j,k. On the other hand, referential transparency can help he…

C# accomplishes this with structs: http://weblogs.asp.net/dixin/archive/2007/12/20/understandin...

Such a thing could be done in Java if Oracle added structs. They're basically just "unboxed objects". I believe there's more to it than that, but that's the basic idea.

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#89
post #20
post #3

Wow, how can you seriously plan releases of a programming language out to 2021? That is an eternity in this industry. Even 2015 for JDK 9 seems mighty far off, especially accounting for the usual slippage of release dates with big software projects.

Why don't they start now and build Java 2.0 from ground up instead of Java 10 for 2017? That would be way faster and they learned so much by now to make a great successor. Who wants a Java 1.x in 2040?

Isn't that what Scala already does quite successfully for a while now?

Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives

#90
post #20

Earlier quoted context omitted.

Why don't they start now and build Java 2.0 from ground up instead of Java 10 for 2017? That would be way faster and they learned so much by now to make a great successor. Who wants a Java 1.x in 2040?

Because they learned from netscape's mistake, that's why. http://www.joelonsoftware.com/articles/fog0000000069.html

That article is an incredibly useful warning against the temptation for casually taking code rewrites, but it's incomplete.

Sometimes full rewrites are necessary and good. The trick is doing it correctly. Rewrites are riskier, more difficult, and require more development resources than greenfield development. More so when you consider that you can't just abandon the old code until the new code is mature and has proven itself.

Most people do rewrites the wrong way, and they get into trouble, but that doesn't mean there isn't a right way. There are many examples of unsuccessful rewrites in history, but also many examples of highly successful ones.

Post reply on HN