Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • > Generic types such as List<T> and Comparable<T> can be instantiated with value classes as the type arguments.

    > JEP 218, Generics over Primitive Types (with revisions), will allow generic classes and methods to specialize field, array, and local variable layouts when parameterized by value class types.

    Ok now this is cool! JVM needs more ways to use compile time known value sizes for better memory allocation and optimizations.

  • If I understand this correctly then Integer becomes a value class and every instance of it loses its object identity.

    I do not have a lot of knowledge about the details but from the outset it seems like a rather bold move to me.

  • It's pretty interesting that while both languages still receive new features, Java seems to stay ahead of JavaScript:

    - Java has long had a modern replacement for Date, while JavaScript's recently standardized Temporal API still isn't supported in Safari.

    - Java has switch expressions, while JavaScript, despite its Scheme influence, does not.

    - And now Java is getting value objects, while JavaScript's equivalent tuples & records proposal has been withdrawn.[0]

    JavaScript was not developed as a fork of Java, but much of its basic syntax still resembles Java, so I think it's fair to compare them.

    [0]: https://github.com/tc39/proposal-record-tuple

  • It's really nice to see movement here finally. Lack of value types has been one of the biggest performance pitfalls in Java for decades at this point
  • Modern Java friggen rocks. I honestly cannot understand why you would use anything but the OG these days!
  • I'm always amazed by how much thinking and work the Java leads put in rolling out changes that move the language forward, but make it backward compatible as much as possible.
  • I think it is important to understand what this does and does not cover. This is “only the first part of Valhalla”. See e.g. a good summary at https://www.jvm-weekly.com/p/project-valhalla-explained-how-...
  • I feel lonely in that: I mostly love Java as a language.

    The lack of value types is the biggest impediment to certain types of performance. I am really looking forward to this evolution of the language.

Explore Birbla archives