<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <font size="4" face="monospace">I appreciate the attempt to avoid
      the rabbit hole -- but there are just so many rabbits!  But let me
      try to separate the layers.  Each of these is a substantial
      discussion, and we're still gathering our thoughts on most of
      them.  <br>
      <br>
      We have to be very careful to separate the notations we use for
      discussing the semantics from notations that are being seriously
      proposed as part of the user model.  Let's assume we are a long
      way from talking about what the surface syntax might look like.<br>
      <br>
      For a use of a type variable, there are four possible ways to
      combine a type variable with nullity information.  Let's call "the
      argument type" the thing the user put in the pointy brackets.<br>
      <br>
       - T! -- the argument type, but null-restricted if it wasn't
      already<br>
       - T? -- the argument type, but explicitly null-allowing if it was
      null-restricted<br>
       - T* -- the argument type<br>
       - T~ -- the argument type, but of *unknown* nullability<br>
      <br>
      I think we can agree we don't want to burden users with all of
      these fine distinctions; there is a discussion to be had about
      "what does bare T mean", but we should wait.<br>
      <br>
      The reason we even talk about T* vs T~ is because of _migration_. 
      And, unlike the migration from non-generic to generic, we have to
      deal with three separate migration scenarios:<br>
      <br>
       - the client wants to use null-marked parameterizations
      (Foo<String!>), but the class has not yet considered nullity
      restrictions (legacy class)<br>
       - the class wants to use null markings in its API, but the client
      is not prepared to deal with nullity restrictions (legacy client)<br>
       - both client and class are null-aware<br>
      <br>
      So T~ is the type variable equivalent of "I have some old
      pre-nullity code, I have no idea what it thinks the nullity of
      this type is".<br>
      <br>
      We of course want to get to the point where we get maximal type
      checking in the last stage, but we don't want to put impediments
      in people's way, and are aware that they may take either path. 
      There are many tradeoffs here about "more restrictions but sounder
      type checking" vs "lenient but more chances for runtime errors." 
      A strict "flag day" transition from "old world" to "new world" on
      both sides would have simple semantics, but would be a horrible
      experience for users, which would drastically slow the uptake of
      the feature.  <br>
      <br>
      <br>
      <br>
    </font><br>
    <div class="moz-cite-prefix">On 9/4/2024 10:06 AM, <a class="moz-txt-link-abbreviated" href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</a>
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:1750449966.63590551.1725458789773.JavaMail.zimbra@univ-eiffel.fr">
      
      <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000">
        <div><br>
        </div>
        <div><br>
        </div>
        <hr id="zwchr" data-marker="__DIVIDER__">
        <div data-marker="__HEADERS__">
          <blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From:
            </b>"Brian Goetz" <a class="moz-txt-link-rfc2396E" href="mailto:brian.goetz@oracle.com"><brian.goetz@oracle.com></a><br>
            <b>To: </b>"Remi Forax" <a class="moz-txt-link-rfc2396E" href="mailto:forax@univ-mlv.fr"><forax@univ-mlv.fr></a><br>
            <b>Cc: </b>"valhalla-spec-experts"
            <a class="moz-txt-link-rfc2396E" href="mailto:valhalla-spec-experts@openjdk.java.net"><valhalla-spec-experts@openjdk.java.net></a><br>
            <b>Sent: </b>Wednesday, September 4, 2024 3:26:01 PM<br>
            <b>Subject: </b>Re: Null-Restricted and Nullable Types<br>
          </blockquote>
        </div>
        <div data-marker="__QUOTED_TEXT__">
          <blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><font size="4" face="monospace">Let's take a step back.  Are you
              looking for *answers* in the short term (say, so you can
              answer someone elses questions), or are you looking to
              open the dialog about how we will expose nullness for
              purposes of generics migration?  Because there are many,
              many pages of things to say about these questions, not all
              of which we have answers to, and this will significantly
              affect how we structure the discussion.</font></blockquote>
          <div><br>
          </div>
          <div>I'm opening the discussion. Those questions are like
            anchors to me, to try to avoid to go too deep into one of
            the rabbit holes.<br data-mce-bogus="1">
          </div>
          <div><br data-mce-bogus="1">
          </div>
          <div>Rémi<br data-mce-bogus="1">
          </div>
          <div><br data-mce-bogus="1">
          </div>
          <blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><br>
            <br>
            <div class="moz-cite-prefix">On 9/4/2024 8:36 AM, <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:forax@univ-mlv.fr" target="_blank" moz-do-not-send="true">forax@univ-mlv.fr</a> wrote:<br>
            </div>
            <blockquote cite="mid:154950232.63481176.1725453401380.JavaMail.zimbra@univ-eiffel.fr">
              <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000">
                <div>Here are my questions:<br>
                </div>
                <div><br>
                </div>
                <div>1/ Nullness of type variable<br>
                </div>
                <div>  "Like other types, a type-variable type (that is,
                  a <em>use</em> of a type variable) may express
                  nullness. <code>T!</code> is a null-restricted type,
                  and <code>T?</code> is a nullable type."<br>
                </div>
                <div> - what does 'T' exactly mean ?<br>
                </div>
                <div>   For me, there is the old 'T' which propagate the
                  type but not propagate the nullability and there is
                  the new 'T' that propagate both the type and the
                  nullability of the type.<br>
                </div>
                <div>   During the JVMLS, Dan Smith references them as
                  'T' and 'T*'. </div>
                <div><br>
                </div>
                <div>2/ If we agree that there are 4 different kinds:
                  String/T, String?/T?, String!/T! and T*, we now have
                  the choice of several user facing models<br>
                </div>
                <div>  - model 1, we let the user annotate using '!',
                  '?' and '*'<br>
                </div>
                <div>  - model 2, we have an opt-in mechanism that set
                  type as '!' by default and type variable as '*' by
                  default.<br>
                </div>
                <div>  - model 3, we only let user to annotate type
                  variable declaration, type of field, type of parameter
                  types/return type, parametrized type (inside the angle
                  brackets) and cast, the rest is inferred<br>
                      (this is the semantics of jspecify).</div>
                <div><br>
                </div>
                <div>
                  <div>3/ Nullness of wildcards<br>
                  </div>
                  <div>  "A type variable declaration or wildcard may
                    have nullness markers on its bounds. A type may
                    satisfy the bounds via nullness conversion, though,
                    so again these nullness markers are not strongly
                    enforced, but may cause warnings."<br>
                  </div>
                  <div><br>
                  </div>
                  <div>  => I see two questions here :<br>
                  </div>
                  <div>   - unbounded wildcards, they are special
                    because they represent a reified type, so ? is
                    nullable in List<?> because list.add(null) is
                    valid at runtime, thus List<?> is equivalent
                    to List<? extends Object?>.</div>
                  <div>     Do you agree ?</div>
                  <div>   - super wildcard, the content of List<?
                    super Foo!> may accept null because Foo? is a
                    super type of Foo!, so List<? super Foo!> is
                    maybe nullable or maybe not,</div>
                  <div>     so the content is neither a '!' nor a '?'.
                    Do you agree ?</div>
                </div>
                <div><br>
                </div>
                <div>Rémi<br>
                </div>
                <div><br>
                </div>
                <hr id="zwchr">
                <div>
                  <blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From:
                    </b>"Brian Goetz" <a class="moz-txt-link-rfc2396E" href="mailto:brian.goetz@oracle.com" target="_blank" moz-do-not-send="true"><brian.goetz@oracle.com></a><br>
                    <b>To: </b>"Remi Forax" <a class="moz-txt-link-rfc2396E" href="mailto:forax@univ-mlv.fr" target="_blank" moz-do-not-send="true"><forax@univ-mlv.fr></a>,
                    "valhalla-spec-experts" <a class="moz-txt-link-rfc2396E" href="mailto:valhalla-spec-experts@openjdk.java.net" target="_blank" moz-do-not-send="true"><valhalla-spec-experts@openjdk.java.net></a><br>
                    <b>Sent: </b>Tuesday, September 3, 2024 10:44:03 PM<br>
                    <b>Subject: </b>Re: Null-Restricted and Nullable
                    Types<br>
                  </blockquote>
                </div>
                <div>
                  <blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><font size="4" face="monospace">There are many points
                      that are not clear to us as well, but we will try
                      to respond to your questions :)</font><br>
                    <br>
                    <div class="moz-cite-prefix">On 9/3/2024 4:41 PM,
                      Remi Forax wrote:<br>
                    </div>
                    <blockquote cite="mid:1949658111.62587211.1725396089114.JavaMail.zimbra@univ-eiffel.fr">
                      <pre class="moz-quote-pre">Hello,
if everybody is okay with that i would like to discuss about Null-Restricted and Nullable Types [1] tomorrow.

There are several points that are not clear to me, i will try to come up with a list for tomorrow.

Rémi

[1] <a class="moz-txt-link-freetext" href="https://openjdk.org/jeps/8303099" target="_blank" moz-do-not-send="true">https://openjdk.org/jeps/8303099</a>
</pre>
                    </blockquote>
                    <br>
                    <br>
                  </blockquote>
                </div>
              </div>
            </blockquote>
            <br>
            <br>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>