> On Jan 5, 2022, at 4:45 PM, Dan Smith <daniel.sm...@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. 

Having the required hardwired null-arg constructor syntactixally 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. 

Reply via email to