[External] : Re: Consolidating the user model
John Rose
john.r.rose at oracle.com
Wed Nov 3 16:02:18 UTC 2021
On Nov 2, 2021, at 4:53 PM, Brian Goetz <brian.goetz at oracle.com<mailto:brian.goetz at oracle.com>> wrote:
Actually, that makes me start to wonder if `getClass()` should be another method like `notify` that simply doesn't make sense to call on value types. (But we still need the two distinct Class instances per class anyway.)
You could argue that it doesn't make sense on the values, but surely it makes sense on their boxes. But its a thin argument, since classes extend Object, and we want to treat values as objects (without appealing to boxing) for purposes of invoking methods, accessing fields, etc. So getClass() shouldn't be different.
One way to thicken this thin argument is to say that Point is not really a class. It’s a primitive. Then it still has a value-set inclusion relation to Object, but it’s not a sub-class of Object. It is a value-set subtype.
It’s probably fruitless, but worth brainstorming as a heuristic for possible moves, so… we could say that:
- Point is not a class, it’s a primitive with a value set
- Point is not a subclass of Object, it’s a subtype (with value set conversion, like int <: long)
- !(Point *is a* Object) & (Point *has a* Object box)
- Point does not (cannot) inherit methods from Object
- Point can *execute* methods from Object, but only after value-set mapping
More information about the valhalla-spec-observers
mailing list