> From: "Remi Forax" <fo...@univ-mlv.fr>
> To: "Kevin Bourrillion" <kev...@google.com>
> Cc: "valhalla-spec-experts" <valhalla-spec-experts@openjdk.java.net>
> Sent: Monday, April 25, 2022 12:23:32 AM
> Subject: Re: Objects vs. values, the continuation

>> From: "Kevin Bourrillion" <kev...@google.com>
>> To: "valhalla-spec-experts" <valhalla-spec-experts@openjdk.java.net>
>> Sent: Saturday, April 23, 2022 12:38:12 AM
>> Subject: Objects vs. values, the continuation

>> I'd like to remind everyone about this (self-important-sounding) document I
>> shared some months ago: [
>> https://docs.google.com/document/d/1J-a_K87P-R3TscD4uW2Qsbt5BlBR_7uX_BekwJ5BLSE/preview
>> | Data in Java programs: a basic conceptual model ]
>> I may have undersold it a bit last time. True, it's not the final word on the
>> only possible conceptual model anyone could ever form; however, it is at 
>> least
>> a very extensively thought-out and reviewed and self-consistent one. I've 
>> also
>> revised it a lot since you saw it (and it's still open for review). If 
>> nothing
>> else, at least when I make arguments on this list you don't have to wonder 
>> what
>> they are based on; I've laid it all out in black and white. And on that
>> subject...

>> The crux of that doc for Valhalla purposes is its clear separation between
>> objects and values as wholly disjoint concepts.

>> An object : has its own independent existence; is self-describing, thus can 
>> be
>> polymorphic; is always indirected / accessed via reference; is eligible to 
>> have
>> identity.

>> A value : has no independent existence; is container-described, thus is 
>> strictly
>> monomorphic; is always used directly / inline; cannot have identity. (Yes, 
>> I'm
>> glossing over that references are also values, here.)

>> What unifies objects and values (setting aside references) is that they are 
>> all
>> instances .

>> (First, to parrot Brian of a while ago: for a primitive type, the values are 
>> the
>> instances of the type; for a reference type, the values are references to the
>> instances of the type, those instances being objects.)

>> Some instances are of a type that came from a class, so they get to have 
>> members
>> . Some instances of are of a type that never used to have a class, but will 
>> now
>> (int, etc.) -- yay. And some are of array types, which act like halfway-fake
>> classes with a few halfway-fake members. Members for everybody, more or less!

>> Though we have at times said "the goal of Valhalla is to make everything an
>> object", I claim the unification we really want is for everything to be a 
>> class
>> instance. I think that gives us enough common ground to focus on when we 
>> don't
>> otherwise know which thing the thing is (e.g. with a type variable).

> As we discussed earlier, there are two approaches, one is to say that
> instance of class = object | value
> the other is to say that
> instance of class = object = reference object | immediate object

> I prefer the later to the former, because it does not goes against what people
> already think, said differently we add more vocabulary instead of trying to
> refine the existing vocabulary.

> I've done several talks on Valhalla,

(oops, part of that sentence went missing) 
I've done several talks on Valhalla, talking about value object or immediate 
object resonate more with the attendees than trying to redefine what an 
instance of a class is. 

RĂ©mi 

Reply via email to