The interfaces IdentityObject and ValueObject must die !

John Rose john.r.rose at oracle.com
Thu Jan 27 01:18:03 UTC 2022


On 26 Jan 2022, at 16:36, Dan Smith wrote:

> An instance of a class is also an instance of (and carries the 
> properties of) its superclasses. Value objects are instances of the 
> class Object.
>
> I can imagine a design in which we say that instances of Object may be 
> either identity or value objects, but direct instances of the class 
> are always identity objects. But this is not how we've handled the 
> property anywhere else, and it breaks some invariants. We've gotten 
> where we are because it seemed less disruptive to introduce a subclass 
> of Object that can behave like a normal identity class.

And yet there is also a second way a class can be an instance; it can be 
*exactly an instance of C*, when `x.getClass()==C.class`.  That’s the 
condition which can be teased apart here, if we allow ourselves to use 
something other than marker interfaces.  But marker interfaces (as I 
said) are committed to ignoring the “exactly an instance” condition, 
because they inherit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/valhalla-spec-experts/attachments/20220126/35259acc/attachment.htm>


More information about the valhalla-spec-experts mailing list