Live data from Hacker News

Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

jvm-weekly.com

241–250 of 464 posts

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#241

stopped reading when i saw the AI illustration. wholly unnecessary, and it feels insulting to be fed slop like this... if you really want a fun drawing get a human artist to do it. it doesn't need to be complicated, for example https://www.code-cartoons.com/ is mostly just stick figures and does an excellent job but you don't even need any of that, a mermaid diagram would have worked perfectly fine too. instead you c…

I simply do not trust articles that use slop imagery like this. I assume the text of this article (and realistically, most articles posted here) is also slop, but it's often difficult to tell.

If you don't have the time or put in the effort to make your article, I'm not going to spend time and effort reading it. You really don't need some generic cartoon guy hovering over your graphs, draw them in MS paint or something.

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#242
post #16
post #8

Earlier quoted context omitted.

I don't wanna badmouth Java people, but how they push the idea that this thing is some sort of genuine breakthrough that took multiple PhDs years of cutting-edge research to implement, when in fact they basically copied what .NET did from basically year 1, is not a good look. Again, not trying to turn this into a .NET vs Java thing, I'd have been much happier if they reached some new and interesting conclusions.

> genuine breakthrough Well, it is - because they had to make it with almost perfect backwards compatibility for one of the most popular languages with trillions of lines of code produced over decades. Sure, adding it to a new language is not hard. Adding it to Java which has primitives, generics and boxing, finding ways that seamlessly cover the differences between objects and primitives, while trying to plan for th…

> because they had to make it with almost perfect backwards compatibility for one of the most popular languages with trillions of lines of code produced over decades.

At what cost? A key benefit of value types is improved performance but AFAIK Valhalla doesn't even let you pass them by reference. Efficiently passing them through registers is great but won't help you out with larger value types.

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#243

Earlier quoted context omitted.

Part of the reason Java hasn't reified generics is because C# did and it was a real big headache that also limited non-C# languages on the C# runtime (CLI?). Everything had to be recompiled to work with newer C# runtimes. While it's pretty easy to run a bunch of language on the JVM (Javascript, python, ruby, clojure) doing the same for C# is somewhat a nightmare, particularly for non-type aware languages. For example…

I don’t think that’s the case. You can absolutely implement a type-erased language on top of the CLR. Your language will just have the same constraints of a type-erased language like Java. Having reified generics in the CLR just lets you store more type information. There isn’t much of a trade off for CLR end-users. Compare this to the constraints and workarounds that Kotlin and Scala have due to type-erasure on the…

> Compare this to the constraints and workarounds that Kotlin and Scala have due to type-erasure on the JVM.

The creator of Scala disagrees: https://youtu.be/Xn_YpUtXWT4?t=850

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#244

Great write-up. Java is getting so good. The improvements over the last decade have been unbelievable. The negativity here is bizarre. Just a reflex I suppose.

And I notice, people aren't aware more things are being planned for. For example, the carrier classes being proposed, they will separate state description with state representation and this is where value classes will shine syntactically.

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#245
post #68

Earlier quoted context omitted.

I like how you point out inaccuracies and next paragraph you deliver couple more, finishing with “language wars are silly and pointless”.

> inaccuracies Like what?

  legacy .NET to .NET Core (which was renamed once again to .NET)  
It was always .NET, only that new one had 1 till 4 had additional "Core" to clarify any confusion that could come from having same numbers as old.

  here's .NET's simplistic garbage collector ... it tries to be a one-fit-all solution that basically cannot be tweaked at all  
Definitely tweaking GC is not a thing in .NET land but it is far from "cannot be tweaked at all".

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#246
post #109

Earlier quoted context omitted.

> The whole attitude and process around this and the other topics gives me very little faith that Java can be steered in a sensible direction here. I agree. The stewardship of Java seems rather lacking - particularly when compared to that of .net, where MS etc. mostly seemed to make the correct decisions from the start. Does Java even have any value or mindshare at Oracle nowadays? The company seems to be a datacentr…

Given the mess of some .NET frameworks currently, and how bad it has taken for non nullable references to be widely adopted, I don't see those correct decisions on the last releases. It is all about having AI on the framework, Aspire, multiple Web and Desktop frameworks all over the landscape. Those interceptors and inline arrays via attributes instead of proper language grammar aren't that great either.

>Those interceptors and inline arrays via attributes instead of proper language grammar aren't that great either.

Yeah. Even when they add new grammar nowadays, it's always just something that trivially sugars away into previous grammar (see: records, `with` clones, extension properties, required, etc).

The moment they need something that it's slightly more complex... Out of scope. Even when it's completely necessary for the thing to be useful in practice.

For example, they added `required`, `record`s and property initializers, giving us good reasons to write `new Foo { A = a, B = b }` instead of `new Foo(a, b)`. A and B must be positive, so you'd write:

  public required int A { get; init => field = value > 0 ? value : throw ... ; }
  public required int B { get; init => field = value > 0 ? value : throw ... ; }
This is pretty standard C# code that you might see in an example for records.

But then the requirements change: A and B must be positive, or they must both be zero at the same time.

This cannot be expressed at all with initializers. You simply cannot add code that runs after all initializers are called. You're stuck chasing every single initialization of Foo and using a constructor or factory method instead. Shipped it as a public API? Too bad. Should have seen it coming!

The new features are filled with this sort of thing. As if Microsoft never used them beyond the most basic examples. Or maybe they did, and explicitly chose not to fix it and solve later.

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#247
post #75

Earlier quoted context omitted.

First, your parent comment misunderstood what the section they were critiquing is referring to. It's not about nullability (which is orthogonal) but about reference/value projections. Now, as a member of the Java team (although I'm not directly involved in Valhalla), I'm obviously biased so let me just say that both designers and fans of programming language features would do well to remember two things: 1. Opinions…

This is great advice and it applies to a lot more than just language features. Different architecture, deployment setups, QA approaches are all like this. It's always "approach A is no good", "but company X uses approach A and they're doing very well", "yeah but look at all of these problems they have". Maybe a fair argument but the approach B people also have their fair share of problems...

GUI frameworks have similar arguments around their design choices.

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#248

> Will I get a fast, flat `ArrayList `? Not yet. Sad. Hope they can do this by the next LTS JDK.

As I understand it, this is anyway an extremely limited perf enhancement - for any class whose data size isn't guaranteed to be atomically writable on your CPU, after including the nullability overhead, it doesn't do anything, basically. On a CPU where 64 bits is the max guaranteed atomic read/write, even Point[] will not get optimized, since you need at least 65 bits of memory for a point value (since it has two 32…

[deleted]

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#249

> But the difference in memory is fundamental. The JVM can now store the values themselves in the array, laid out densely one after another: 8 bytes per point (plus a possible null flag), in a contiguous block. No headers per element. No pointers. No jumping around the heap. How much was this article proof-read? Didn't they just get finished talking about how heap flattening won't work for objects with > 64-bit repre…

The obviously used too much AI, I stopped after 2 paragraphs

I'm tired of people jumping in to point out "AI, AI". The article is very good and informative. That is the only important thing. Geez.

Re: Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

#250
post #223

Earlier quoted context omitted.

The obviously used too much AI, I stopped after 2 paragraphs

The first two paragraphs are > On June 15, Oracle engineer Lois Foltan confirmed what a good chunk of the industry had stopped believing: JEP 401: Value Classes and Objects will be integrated into the main OpenJDK repository and is targeting JDK 28. > The change is so large that the remaining committers were asked to hold off on bigger commits during the integration. The pull request alone adds over 197 thousand line…

These days I'm having second thoughts about pictures that I am pretty certain can't be AI but just have that look. It's strange but I've noticed it happening more and more.
Post reply on HN