----- Mail original -----
> De: "Brian Goetz" <[email protected]>
> À: "Remi Forax" <[email protected]>, "valhalla-spec-experts"
> <[email protected]>
> Envoyé: Dimanche 9 Mai 2021 17:04:31
> Objet: Re: Make new Object() backward compatible
>> The logical conclusion is that java.lang.Object is a parametric class with a
>> parameter saying if it should implement IdentityObject or not.
>
> Magic hammer, meet nail :)
New tool, new tricks :)
Given that we want two classes for java.lang.Object, seeing them as one being a
specialization of the other is not too outrageous.
>
> To be explicit, what you're suggesting is something like
>
> class Object<ID : boolean> { ... }
>
> where an identity class extends Object<true> and a primitive class
> extends Object<false> (and most interfaces remain parametric in ID.)
yes
>
> Its conceptually elegant, and we've discussed it before; in theory
> parametricity could range over things other than types, such as
> constants, identity-ness, etc (e.g., the ref and val projections could
> be species). But to apply it to a problem as prosaic as this seems like
> cracking a walnut with a two-ton bomb. (I don't thing this is what you
> want to teach on day 1.)
It seems that you are thinking that i want to introduce a special syntax just
for specializing java.lang.Object, I don't.
I'm not proposing to change to the source code of Object.java, only the
bytecode.
The compiler will insert the SpecializationAnchor (and the attribute that adds
the identity-ness) without needing any language support.
The VM can also dynamically insert the SpecializationAnchor, but modifying
javac to get the bytecode we want seems an easier path.
Rémi