logoalt Hacker News

rvcdbnyesterday at 8:13 PM4 repliesview on HN

oracle planning a new jvm language? have we ever seen a feature like this that is explicitly not usable from Java?


Replies

cogman10yesterday at 9:37 PM

> have we ever seen a feature like this that is explicitly not usable from Java?

Loads. Invoke dynamic and Nest-Based Access Control come to mind.

This sort of thing is also about tightening the VM specification so things like Valhala are possible. Value classes really can't function reasonably without strict field initialization. That's because these value classes can have multiple copies while an application is running. If there's a way to go in and tinker with the fields before, after, or during initialization it could lead to very hard to fix and debug issues. 1 object in 2 parts of the code with different field values.

And the reason for this tightening is because, from java, there are routes to violate this strict field initialization.

huehoyesterday at 8:37 PM

It's a VM feature - value classes will use it when they land eventually. https://openjdk.org/projects/valhalla/

vips7Ltoday at 12:13 AM

All the time. Oracle and the OpenJdk team do VM changes way more than language changes.

Skinneyyesterday at 8:31 PM

This is required in order to implement value classes in Java (project valhala).