The storage hint model
forax at univ-mlv.fr
forax at univ-mlv.fr
Thu Jul 21 21:55:42 UTC 2022
> From: "Robbe Pincket" <robbepincket at live.be>
> To: "Valhalla Expert Group Observers" <valhalla-spec-observers at openjdk.org>,
> "Remi Forax" <forax at univ-mlv.fr>
> Sent: Thursday, July 21, 2022 11:35:13 PM
> Subject: RE: The storage hint model
> On Thu Jul 21 21:15:23 UTC 2022, Rémi wrote:
>> Differences between C and C.val is really hard to understand because those types
> > are really similar but obey to different rules
>> - C and C.val have no subtyping relationship but if you see a type as a set, C
> > accept null while C.val don't.
> > - you have auto-boxing between a C and a C.val
> > - overloading rules should prefer C.val to C (but maybe not)
> > - the inference with C.val doe not work exactly like the inference with C
> > - an array of C.val is a subtype of an array of C
> > - List<C> and List<C.val> are incompatible types
> > - instanceof C.val is not valid
> > - c.getClass() with c a C.val is typed Class<? extends C> (not C.val).
> I thought `c.getClass()` wasn't gonna be valid, just like you can't do
> `i.getClass()` where `i` is an int.
You may be right, i think Kevin is a proponent of that idea.
>> and this is not an exhaustive list and I'm sure some of them are wrong because
> > even us, experts, have trouble to define the correct set of rules.
>> Basically, it's a mess because we are creating a new kind of types, C.val, that
>> sometimes works like a primitive (hence boxing, overloading, type inference)
>> but sometimes works like an objet (has Object as super class, have an adhoc way
>> to work with wildcards, etc). And then as a user, there is there is the looming
>> question about where to use C vs C.val, which is will be like a long words
> > essay full of particular cases (like the Angelika Langer FAQ for generics).
> I'm a bit confused here. `C.val` doesn't extend `Object` afaik. Just like
> primitives `C.val` has a boxed version `C` that does extend `Object`, much like
> `int` to `Integer` now.
You can call methods on a C.val, so it's an object, it may not directly extends of java.lang.Object like an interface does not extend java.lang.Object but you can call toString() on it.
> I'm gonna be honest, I'm very confused with the `.box`/`.flat` discussions.
given that we are in a phase of throwing things and see what's stick, don't worry :)
> Greetings
> Robbe
Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-observers/attachments/20220721/b37516a4/attachment.htm>
More information about the valhalla-spec-observers
mailing list