Alternative to the suffix .val and .ref in JEP 401: Primitive Objects

Remi Forax forax at
Wed May 12 13:46:33 UTC 2021

----- Mail original -----
> De: "Anderson Vasconcelos Pires" <andvasp at>
> À: "valhalla-dev" <valhalla-dev at>
> Envoyé: Mercredi 12 Mai 2021 04:51:04
> Objet: Alternative to the suffix .val and .ref in JEP 401: Primitive Objects

> Hi guys,


> I saw Michael Kuhlmann's e-mail [1] where he quotes:
> "The suffixes .ref and .val don't fit into our concept of class names, they
> look ugly and can easily be mixed up."
> I have no complaints about them. But I believe it would be better, *if
> possible*, not to use them.
> I believe it would be better to use the operator "?" instead of .ref.
> because it can be used when the "null safety" feature comes to Java. :)
> If it is necessary to represent the .val, the operator "!" could be a
> possibility to help.
> Probably this has already been discussed, but unfortunately is not so easy
> to find out in the archives e-mail.

We have used the notation V? in the past, the JVMS language submit 2019 was the point were we decide to stop using it for different reasons, here is a kind of summary why

More recently, we have explored the fact that some primitive classes may still want to be nullable, allowing null to be assigned to a variable of type Foo.val,
this obviously does not work well is Foo.val is written Foo!

So dividing ref/val types along the axis of the nullabbility is a kind of dead end.


> Kind regards,
> Anderson.


More information about the valhalla-dev mailing list