Are they going to introduce zero-cost structs? Kinda like Rust guarantees that Option has the same size as T (aka free like in free beer).
Java 17 / JDK 17: General Availability
81–90 of 251 posts
Re: Java 17 / JDK 17: General Availability
#82Something I would like to see in Java is for functions to return multiple (named?) values. I think it will reduce boiler plate code considerably.
Re: Java 17 / JDK 17: General Availability
#83Java5 and Java8 were monumental changes to the language… this update probably will have the same legacy. Can’t wait to see the benchmarks out of this bad boy once they get the compilers tuned in.
Re: Java 17 / JDK 17: General Availability
#84I'm curious if it would be possible to remove null from Java. There's already support for Optional. I mean I guess a lot of code would stop compiling, or could it be deprecated somehow.
Re: Java 17 / JDK 17: General Availability
#85Reportedly, not much "big new stuff" got into this release (maybe next time), but it's an LTS so it's not the best time for that anyway.
Can't remember where I heard it, but the thought was that "big stuff" was skipped in case it created bugs that then had to be maintained for the entire LTS support period.
Re: Java 17 / JDK 17: General Availability
#86Earlier quoted context omitted.
Primitive classes are being worked on in Project Valhalla.
I think this statement has been true since about 2014. Structs are nice, as they allow for control over locality, to a degree that is simply not possible in Java currently. But there is a second effect, which is possibly more important: If I can move gigabytes of my data into arrays of structs, then 1) I greatly reduce memory requirements (far fewer pointers), and 2) I greatly reduce the amount of work that GC has to…
As an aside, and not to say that Valhalla is not needed (I am looking forward to it very much, along with Loom), I’ve recently learned that for many use cases (not all) when you want gigabytes of struct arrays, a bunch of equal-sized primitive arrays, one per struct field, might work even better from memory requirement and cache locality perspective.
Re: Java 17 / JDK 17: General Availability
#87Earlier quoted context omitted.
> Language > Pattern Matching for instanceof (16) > Records (16) > Restore Always-Strict Floating-Point Semantics (17) > Sealed Classes (17) > Switch Expressions (14) > Text Blocks (15) This is what excites me. Records, switch expressions and sealed classes are all excellent and even better together. Along with pattern matching switch statements, Java is finally losing a lot of cruft people complain about.
I'm trying to find a good use case for records, but the best I can come up with is using it for composite hashmap keys. I suppose when combined with sealed classes and pattern matching features at some point it might be more useful, but what is the main use for records right now? Given that they're immutable and have no convenient way to be copied when modified, I find them quite tedious to use.
I know the answer is always use IDE and all but it causes more context switches than scrolling a bit to see types I created.
Re: Java 17 / JDK 17: General Availability
#88Earlier quoted context omitted.
Thanks for the Dev.java mention. Our team is excited to launch the site. We focused on minimal design (similar to Inside.java) and heavy on content, mostly learning material to start. More to come soon. Feedback here is welcome!
Great new site Chad! more blogs, tutorials, articles and possibly community contibutons around the same would be awesome to see :)
Re: Java 17 / JDK 17: General Availability
#89> 414: Vector API (Second Incubator) Is it something like C++ vector class?
Re: Java 17 / JDK 17: General Availability
#90Some other news in relation to the release: - (Proposal) Moving JDK LTS versions to a two year cadence [1]. Java 21 will be next LTS instead of Java 23. - Oracle JDK is now free for commercial and production use [2]. - A new Java developer site [3]. [1] https://mreinhold.org/blog/forward-even-faster [2] https://blogs.oracle.com/java/post/free-java-license [3] https://dev.java/
Thanks for the Dev.java mention. Our team is excited to launch the site. We focused on minimal design (similar to Inside.java) and heavy on content, mostly learning material to start. More to come soon. Feedback here is welcome!