JEP 401: Value classes and Objects (Preview) has just been submitted!
Posted by davidalayachew@reddit | programming | View on Reddit | 16 comments
The JDK it is coming out in is still not known. However, this is a major milestone to have crossed. Plus, a new Early Access build of Valhalla (up-to-date with the current JDK, presumably) will go live soon too. Details in the linked post.
And for those unfamiliar, u/brian_goetz is the person leading the Project Valhalla effort. So, comments by him in the linked post can help you separate between assumptions by your average user vs the official words from the Open JDK Team themselves. u/pron98 is another OpenJDK Team member commenting in the linked post.
Atulin@reddit
Java getting one step closer to C#, I see
davidalayachew@reddit (OP)
Well no, Java is going to do their Value Classes differently than see. If I'm not mistaken, C# has mutable structs. Java is explicitly forbidding that. There's a few other differences too.
TOGoS@reddit
Seems a wise choice. Value-values are most useful when I want to return something more complex than an int and I don't want to have to pass in some container to stick the pieces into.
Once you let an object be mutable, that object has to have identity separate from its contents, which is....what every Object in Java already has, and the thing I want to get away from!
Immutable stack-allocated records FTW!!!!
Atulin@reddit
C# has both.
struct
is mutable,readonly struct
is not.davidalayachew@reddit (OP)
Thanks for the correction.
RandomName8@reddit
and to C!
Mognakor@reddit
Don't give people ideas for new programming languages
nuharaf@reddit
Does brian or pron said about new EA. I only remember 'between now and then' which could be anytime really :(
davidalayachew@reddit (OP)
Brian said about it in the /r/java post that this is crossposted from.
Doniisthemaindog@reddit
Exciting to see Valhalla making real progress. Value classes always felt like one of those features that could quietly change the way we design APIs in Java
keketi_@reddit
It's happening.
davidalayachew@reddit (OP)
To provide a bit more context, Project Valhalla is Java's attempt to add value classes (structs, basically) to the language, not just in a backwards compatible way, but in a way that other language features can integrate with it as seamlessly as possible. The goal being to make it look like it was there all along.
It has been a desired feature, basically since the language's inception. People (rightfully) criticize Java and the JVM's memory consumption. This Project was built to address those criticisms head on. Early access builds released a few years ago had some very encouraging, especially since it was just a prototype with only a few Valhalla features implemented.
This project was born right around the release of Java 8 in 2014 (time flies lol). So, after over 10 years, this JEP (JEP 401) will be the first Valhalla JEP to land. The first step towards finally having Project Valhalla implemented in Java.
This is pretty exciting news if you are a Java fan!
davidalayachew@reddit (OP)
Also, if you'd like to see the full list of JEP's (not just limited to Project Valhalla), then here you go -- https://openjdk.org/jeps/0
Lots of cool features coming out soon! Java is improving faster each release!
davidalayachew@reddit (OP)
To provide a bit more context, Project Valhalla is Java's attempt to add value classes (structs, basically) to the language in a backwards compatible way.
It has been a desired feature, basically since the language's inception. People (rightfully) criticize Java and the JVM's memory consumption. This Project was built to address those criticisms head on.
This project was born right around the release of Java 8 in 2014 (time flies lol). So, after over 10 years, this JEP (JEP 401) will be the first Valhalla JEP to land. The first step towards finally having Project Valhalla implemented in Java.
This is pretty exciting news if you are a Java fan!
BlueGoliath@reddit
Year of Valhalla. Much mead shall bring drunk.
davidalayachew@reddit (OP)
Looks like we'll actually live long enough to see it come out ourselves!