logoalt Hacker News

JEP 401: Value Objects (Preview) merged to OpenJDK master

119 pointsby mfiguieretoday at 4:38 AM56 commentsview on HN

Comments

timmgtoday at 7:20 AM

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.

show 3 replies
sheepttoday at 7:21 AM

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

show 4 replies
mormegiltoday at 9:33 AM

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-...

ludovicianultoday at 8:18 AM

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.

pregnenolonetoday at 9:59 AM

That's great, even though specialized generics are still missing. I think these improvements will be especially beneficial for Scala, because it is such a powerful language, but abstracting on the JVM comes at a heavy price.

weinzierltoday at 6:48 AM

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.

show 3 replies
swiftcodertoday at 7:25 AM

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

parallax_errortoday at 8:12 AM

Really cool, shame that strings can’t be fully indistinguishable like Integer despite their immutability

show 1 reply
germandiagotoday at 6:00 AM

2934 commits OMG... huge work.

show 4 replies
HexDecOctBintoday at 7:03 AM

What's the latest status? Is it still limited to 63-bits of data plus 1 bit for nullability?

show 1 reply
ligarotatoday at 6:18 AM

The MR is closed

This is it https://github.com/openjdk/jdk/commit/cc278dbb8a1ca0754d5842...

show 1 reply
whytevuhunitoday at 6:07 AM

How much of Valhalla is this? 50% of it? 90% of it?

show 1 reply