IdentityObject and InlineObject

Brian Goetz brian.goetz at
Sun Apr 12 15:59:11 UTC 2020

> Possible candidates:
>  - Identity, as in "class Foo implements Identity".  This says what it 
> means, though it is quite possible that it will clash with existing 
> types.  (This is not an absolute disqualifier, but it is a 
> consideration.)
>  - IdentityObject.  This is where we are now; it always felt a little 
> clunky to me.
>  - ObjectIdentity ("class Foo implements ObjectIdentity").  Better 
> than IdentityObject, less likely to clash than Identity.
>  - WithIdentity.  Not the best name, but less likely than Identity to 
> clash.
> Others?

Thinking on this for a few days ...

I like "Identity" but it is sure to clash with every ORM and similar 
system out there.  I think I slightly prefer `ObjectIdentity` to 
`IdentityObject`, and both to `WithIdentity` and `HasIdentity`.

Note that originally we were thinking that these types might be abstract 
classes; now that they are interfaces, this has slight consequences for 
the natural naming, as interfaces are often named for adjectives 
(Comparable) but abstract classes are almost always named for nouns.  We 
should evaluate these, in part, on how they sound in

     class C implements I


     class String implements ObjectIdentity

more directly expresses the point -- that one of the behaviors of String 
is that it has an object identity -- than does:

     class String implements IdentityObject

It also puts the focus on the _identity_, rather than the object itself, 
which is consistent with breaking this behavior out of the root type and 
into a "mix in."

More information about the valhalla-spec-observers mailing list