Question about universal type variables

Remi Forax forax at univ-mlv.fr
Wed Jul 27 21:59:43 UTC 2022


> From: "Robbe Pincket" <robbepincket at live.be>
> To: "Brian Goetz" <brian.goetz at oracle.com>
> Cc: "Valhalla Expert Group Observers" <valhalla-spec-observers at openjdk.org>,
> "Kevin Bourrillion" <kevinb at google.com>
> Sent: Wednesday, July 27, 2022 9:37:21 PM
> Subject: RE: Question about universal type variables

> On Wed Jul 27 19:22:51 UTC 2022, Brian Goetz wrote:

> > It is a type of indeterminate ref-ness or val-ness. This will have both

> restrict some old behavior and provide some new behavior. For example:



> > T t = null;



> > will generate an unchecked warning, since we can't be sure we're not

> polluting the heap with nulls.

> I seem to remember there being talks about `IdentityObject` and `ValueObject`
> interfaces or something similar, is this still planned.

No, it's not anymore. 

> If so, would the warning go away if `T` has a typebound of `IdentityObject` and
> become an error if it has a typebound of `ValueObject`

> Regards

> Robbe Pincket

There are still cases where because of the bound of the type variable, a value class is not possible 
- if the bound is a class 
- if the bound is an abstract class with at least a constructor. 

but i'm not sure it's a good idea to change the type checking depending on those property. 

regards, 
Rémi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-observers/attachments/20220727/ea8599d6/attachment.htm>


More information about the valhalla-spec-observers mailing list