<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="NL-BE" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB">On Thu Jul 21 21:15:23 UTC 2022, Rémi wrote:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> Differences between C and C.val is really hard to understand because those types are really similar but obey to different rules<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> - 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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> - you have auto-boxing between a C and a C.val<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> - overloading rules should prefer C.val to C (but maybe not)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> - the inference with C.val doe not work exactly like the inference with C
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> - an array of C.val is a subtype of an array of C<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> - List<C> and List<C.val> are incompatible types<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> - instanceof C.val is not valid<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> - c.getClass() with c a C.val is typed Class<? extends C> (not C.val).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I thought `c.getClass()` wasn't gonna be valid, just like you can't do `i.getClass()` where `i` is an int.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> 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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">> 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).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I'm gonna be honest, I'm very confused with the `.box`/`.flat` discussions.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Greetings<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Robbe</span><span lang="EN-GB"><o:p></o:p></span></p>
</div>
</body>
</html>