where are all the objects?
John Rose
john.r.rose at oracle.com
Thu Aug 11 21:54:47 UTC 2022
I could live with this. It doubles down on “everything is an
object”, and something might be modeled separately as a non-object a
“value”, is just a sub-kind of object, hence “value object”.
So the real big divide is not between objects and non-objects, but
between value-objects and identity-objects. And, as befits a world
where everybody is in the object family, it’s a gentle divide, since
values and identities have lots in common: references, methods, `extends
Object`. Meanwhile, the symmetric difference of value and identity
contains, on the one side, the option for “direct” storage (whatever
that means; it’s vague but real), and on the other side mutability,
etc.
A couple more comments below:
On 11 Aug 2022, at 13:08, Brian Goetz wrote:
> …So:
>
> - classes have instances, which are objects
> - some classes are identity classes and some are value classes
> - instances of identity classes have identity, are called
> identity objects
> - instances of value classes have no identity, are called value
> objects
> - any objects can be the target of an object reference
> - Polymorphic types like Object or Runnable may refer to identity
> or value objects
> - value objects can be represented/stored/manipulated directly as
> well, like our old friend int
> - legacy primitive are value objects now!
> - everything is an object
> - The type P.ref is a reference type, it consists of references to
> instances of P
Tedious pedant is tediously pedantic: or `null`.
> - The type P.val is a value type, it consists of instances of P,
> which are value objects
> - Integer is a reference type, int is a value type
Maybe emphasize the linkage: `Integer.val`, `int.ref` are a aliases for
`int` and `Integer`
>
> This isn't much different from the previous "VAO" presentation, other
> than being more explicit about saying "value objects" rather than just
> values --
> does that help at all?
I think it does. Saying “values” unqualified suggests (misleadingly
for VAO) that not everything is an object.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-observers/attachments/20220811/91b209c9/attachment-0001.htm>
More information about the valhalla-spec-observers
mailing list