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

John Rose john.r.rose at
Fri May 8 00:41:03 UTC 2020

On May 7, 2020, at 2:57 PM, Mateusz Romanowski <romanowski.mateusz at> wrote:
> accessibility of V.val and V.ref is same

That’s not necessarily true.  It’s possible, at least in the JVM,
for one type to be less public than the other.  They are necessarily
in the same package and module, but can independently be
package-private or public, to the JVM.  We are working out
language details on this, so stay tuned.  The idea of making
V.ref more public than V.val is related to the idea of giving
the “good name” V to one or the other type; you might want
Optional to be public and mean Optional.ref, while Optional.val
is private, if for some reason you wanted to conceal the new
inline aspect.  (I don’t think we do in the case of Optional,
but you get the idea:  A type might be publicly ref-flavored,
with a hidden val aspect.  The other way around seems
less useful to me, but who knows.)

And still, a friendlier solution would be to allow both to be public
but “hook” the conversion, relative to null, in the way we
discussed.  That’s a future discussion.

— John

More information about the valhalla-dev mailing list