I know the article didn't mention it, I also wonder what the memory bloat will look like when they turn all primitives into Objects and introduce object overhead just to track int i in a for loop.
Java 9 with GPU processing, Java 10 will be all-OOP without primitives
11–20 of 138 posts
Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives
#12Earlier quoted context omitted.
This is a very good point. If functions become objects, interfaces would become literally useless. Somehow it seems that it would not be the case since this would be a drastic change (even thought getting rid of primitives are as well.)
Literally useless? Would you like to elaborate on how specifying a contract that has to be implemented is suddenly useless because you have function types?
[edit: apparently my sarcasm was too subtle. HOF and typeclasses are both vitally important pieces of Haskell, which are orthogonal to each other. I'm pretty sure both were in Haskell from day 1. Some code for which both are essential:
class Monad m where
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
return :: a -> m a
fail :: String -> m a
]Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives
#13All-OOP? So functions will be objects too? And classes? And contexts? Not meaning to start a flame, just saying the title's a bit inaccurate IMHO...
Classes are already objects. I don't know whether Java 8 will finally introduce function as a data type, but if it does, I'm pretty sure they won't do it the way Ruby blocks work (i.e. block is not an object).
Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives
#14It 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…
Even if these things turn out to be impossible to optimize at compile time, they're probably then betting on JIT functionality to detect primitive objects that are only used as primitives.
Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives
#15Wow, 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.
Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives
#16Earlier quoted context omitted.
Literally useless? Would you like to elaborate on how specifying a contract that has to be implemented is suddenly useless because you have function types?
I think the experience of Haskell is relevant here. Once Haskell introduced first class functions, everyone stopped using typeclasses. [edit: apparently my sarcasm was too subtle. HOF and typeclasses are both vitally important pieces of Haskell, which are orthogonal to each other. I'm pretty sure both were in Haskell from day 1. Some code for which both are essential: class Monad m where (>>=) :: m a -> (a -> m b) ->…
[] This statement is based purely on my own experience. I find the Haskell documentation a bit unfriendly with its "academic" style. The content is great, but the form makes it a bit hard to assimilate. Monads were especially painful.
Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives
#17All-OOP? So functions will be objects too? And classes? And contexts? Not meaning to start a flame, just saying the title's a bit inaccurate IMHO...
I think similar to C# where the primitives are objects is what they want, terribly misleading title I agree. However, I cringe when I think of what this does to performance. The memory overhead of objects in java is pretty high (relative) while primitives are very memory efficient. If they can make the primitives just as efficient, it would be awesome, but I guess its a wait and see. I don't currently mind using the…
So if you have a class:
public class X {
public Int32 i;
public Int32 j;
public Int32 k;
}
Then it takes 12 bytes + single object overhead (which in MS .NET I believe is two pointers).But if you assign a primitive (e.g. Int32) to an variable of type 'object' then it will be boxed and then require the object overhead.
A neat thing about C#/.NET is that generics are baked deeply into the platform, so using primitive (actually, any value-type struct) types as generic arguments will not require object memory or casting overheads.
Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives
#18Earlier quoted context omitted.
Classes are already objects. I don't know whether Java 8 will finally introduce function as a data type, but if it does, I'm pretty sure they won't do it the way Ruby blocks work (i.e. block is not an object).
Aren't methods already an object of class java.lang.reflect.Method? Do you mean you should be able to do something like foo(PrintStream.println.method) like you can do foo(PrintStream.class)?
Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives
#19Wow, 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.
Re: Java 9 with GPU processing, Java 10 will be all-OOP without primitives
#20Wow, 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.
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?