Updated State of Valhalla documents

forax at univ-mlv.fr forax at univ-mlv.fr
Thu Jan 6 18:40:02 UTC 2022


----- Original Message -----
> From: "John Rose" <john.r.rose at oracle.com>
> To: "daniel smith" <daniel.smith at oracle.com>
> Cc: "Remi Forax" <forax at univ-mlv.fr>, "valhalla-spec-experts" <valhalla-spec-experts at openjdk.java.net>
> Sent: Thursday, January 6, 2022 4:53:28 AM
> Subject: Re: Updated State of Valhalla documents

>> On Jan 5, 2022, at 4:45 PM, Dan Smith <Daniel.Smith at oracle.com> wrote:
>> 
>> Not talking about the VM. I'm talking about the language model.
>> 
>>> A primitive (B3) does not provide proper encapsulation unlike a classical Java
>>> class (the one spelt "class" in the language),
>> 
>> You should say "object" here, not "class". Primitive values have classes, even
>> though they are not objects.
> 
> Yes. And what’s more, Remi’s point about encapsulation is weak, because we can
> (possibly) assume that every author of a primitive class has checked those
> boxes off, saying that all-zero default is a valid value and tearing is
> acceptable. There are plenty of Java B1 classes today that are designed with
> such weaknesses. Class abstractions come in various strengths as selected by
> each class’s author. Selecting primitive for a class forces the author to gives
> up some abstraction but keeps most abstraction decisions intact.


Being a primitive weaken the encapsulation, but your are right that it's not a all or nothing thing.

> 
> Having the required hardwired null-arg constructor syntactically present is an
> interesting idea to ensure that the author has explicitly “checked the box”
> about the default value. Not sure it’s worth it though.

If we want to check the other box, tearing, at least partially, i suppose that creating a VarHandle on
a non volatile primitive class should be rejected too.

Rémi


More information about the valhalla-spec-observers mailing list