Question about universal type variables

Kevin Bourrillion kevinb at google.com
Wed Aug 3 19:00:54 UTC 2022


On Wed, Aug 3, 2022 at 10:53 AM Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:

On 27/07/2022 23:25, Dan Smith wrote:
> > I'm not*totally*  sure I grasp all the differences, but here are a
> couple of observations that seem to support Model 2:
>
> I'm not sure I grasp the differences between model 1 and 2 either.
>

This is probably because they are conceptual-model differences only --
differences in framing, influencing how we talk about things but usually
leading to the same outcomes (because we rarely weigh "fits a better
conceptual model" as a sufficient reason to *choose* that behavior; the
model is usually just playing catch-up).

For example:


In the same way, universal type-variables cannot answer the question of
> "are you a ref or a val" (in the same way in which today's type variable
> cannot answer the question of: are you an Integer or a Double).
>

This would be Model 1 framing, whereas Model 2 might say "it's neither; it
is itself, a type variable; the relevant question is what types it is
*substitutable* to, or perhaps what *other* types its instances might have".

It might be cleaner to think "T is preserving its substitutability for
either a ref or val type" than either "T might *be* either a ref or val
type" or "T is a special 'ref-or-val' type".

-- 
Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-observers/attachments/20220803/6a8ca641/attachment-0001.htm>


More information about the valhalla-spec-observers mailing list