Revised JEP: Null-Restricted Value Object Storage
Remi Forax
forax at univ-mlv.fr
Tue Mar 21 17:21:54 UTC 2023
I've just done a first pass.
There is a typo
new Thread(() -> ps[0] = new Point(1.0, 0.0)).run();
should be
new Thread(() -> ps[0] = new Point(1.0, 0.0)).start();
In term of syntax, i'm sure you already knows that
- Not having a keyword at the class level to differentiate between default-instance value type vs value type is not very readable because the optional constructor can be buried deep inside the class body.
- The keyword "non-atomic" on the optional constructor is even weirder, given that has the example shown, the problem is unrelated to using the default value, Point.default or not.
In term of semantics, I really like this JEP :)
regards,
Rémi
----- Original Message -----
> From: "daniel smith" <daniel.smith at oracle.com>
> To: "valhalla-spec-experts" <valhalla-spec-experts at openjdk.java.net>
> Sent: Tuesday, March 21, 2023 5:10:17 PM
> Subject: Revised JEP: Null-Restricted Value Object Storage
> I've updated JEP 401, formerly "Primitive Classes", now titled "Null-Restricted
> Value Object Storage". The purpose of this JEP is to allow for flattening of
> value objects in fields and arrays. This update gets there via two key
> features:
>
> - "Optional" constructors, which express the capability of a value class to have
> instances created outside the normal construction process.
>
> - Null-restricted types, which exclude null from the type's value set, and in
> the case of value classes with optional constructors, allow for a non-null
> default value.
>
> There's more to say about nullness, which is covered by its own JEP that we're
> still working on. But the idea of null-restricted variables is enough to
> unblock progress on value object flattening. (Eventually, we envision—at least
> for now—delivering the two JEPs at the same time.)
>
> The document is here:
>
> https://openjdk.org/jeps/401
More information about the valhalla-spec-experts
mailing list