Could the idea of null-default inline classes be revisited?

John Rose john.r.rose at oracle.com
Wed May 6 19:51:34 UTC 2020


On May 6, 2020, at 12:46 PM, John Rose <john.r.rose at oracle.com> wrote:
> 
> For now, the choice is pretty straightforward:  If you
> need null as a value in a variable of type V, use V.ref.
> If you need flatness in the variable, use V.val.  Choose
> one.

P.S. If you need both, encapsulate the field as a V.val
and transcode between V.default and (V.ref)null in
access methods and constructors.  If you need naked
fields *and* flatness *and* null, you are still out of luck.

Sadly, record types won’t help with this, thought perhaps
there’s some limited call for boxing/unboxing relations
between a record’s internal and external field types;
that’s another can of worms.  Use Java’s class-based
data abstraction!


More information about the valhalla-dev mailing list