----- Mail original -----
> De: "Maurizio Cimadamore" <maurizio.cimadam...@oracle.com>
> À: "Remi Forax" <fo...@univ-mlv.fr>, "valhalla-spec-experts" 
> <valhalla-spec-experts@openjdk.java.net>
> Envoyé: Jeudi 9 Mai 2019 12:00:12
> Objet: Re: It's not safe until it's in the coffer

> Another oddity, that I find hard to explain away:
> 
> Coffer<String> ~= String
> 
> This seems to be a bad property, as you have two types to name the same
> thing.
> 
> You could, in principle, say that the type parameter of Coffer is
> restricted to... values.

yes, the type argument of a Coffer is restricted to an inline class, i've 
forgotten to mention that, thanks.

> 
> But here's the second, pedagogical oddity: Coffer<Value> looks an awful
> lot like a specialized generic type. I think people will be surprised in
> seeing that this magic types works, while the types they want
> (List<Value>) does not.

Yes, it's surprising but it has nothing to do with Coffer or V? but with the 
fact that a T can be nullable and an inline class is not.
Note that the error message saying that List<Value> doesn't work, can suggest 
that List<Coffer<Value>> may work (at least for LW10).

Now, yes, it looks like a specialized generic type and i think it's fine given 
we want to introduce specialized generics types in LW3000. 

> 
> Besides...
> 
> List<Coffer<Value>>
> 
> is reeeallly verbose, do we really want to read code like that?

yes, it's verbose by design.

> 
> At the language level, the number of exceptions this will require all
> over the place, from generic well-formedness to inference (imagine
> passing a 'Value' where a Coffer<Z>) is expected, that, while I can
> sympathize with your opening position of '?' being confusing, it seems
> the proposed cure is worse than the disease :-)

I don't think so, here you are supposing, i believe, that the inference has to 
be changed because inferring Z as an indirect object is not useful.
But we don't have to change the inference, the same way when you have a T... 
you don't have a special inference rule because creating an array of 
parameterized type is unsafe,
the idea is to do the same inference algorithm and at the end, you emit an 
error if Z is not an inline class.

So yes you have some rules around creating a Coffer but they are far less 
invasive than adding a new union type V? in the type system.

> 
> Maurizio

Rémi

> 
> 
> On 08/05/2019 23:12, Remi Forax wrote:
> > There are two oddities:

Reply via email to