<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font size="+1"><tt>That came up in the expression switch
        exploration.  The thinking then, which I think is still valid,
        that it is easier to understand the difference when
        default-totality is attached to the expression versions, because
        expressions _must_ be total and statements totally make sense to
        be partial.  <br>
        <br>
        I think this is still coming from a place of retrospective
        snitch-envy; you want to carve out a corner that has the "right"
        semantics, even if its relation to the other corners is totally
        ad-hoc and random.  The upgrade to switch was driven by
        orthogonality; totality derives from whether the context of the
        switch (statement vs expression) requires totality or embraces
        partiality.  And the kinds of labels are strictly about the
        treatment of what is on the RHS -- either a single {
        expression/statement } vs complex control flow.  Which is
        orthogonal to expression/statement.  <br>
        <br>
        So, I think we got it right then; we just have some holes to
        patch.<br>
      </tt></font><br>
    <div class="moz-cite-prefix">On 9/3/2020 1:04 PM, Remi Forax wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:630127997.639840.1599152672042.JavaMail.zimbra@u-pem.fr">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div id="zimbraEditorContainer" style="font-family: arial,
        helvetica, sans-serif; font-size: 12pt; color: #000000"
        class="15">
        <div>I just want to say that the is yet another option,<br>
        </div>
        <div>say that (statement and expression) arrow switches are
          always total.<br data-mce-bogus="1">
        </div>
        <div><br data-mce-bogus="1">
        </div>
        <div>We have introduced the arrow notation to avoid fallthrough
          but we have forgotten one important case of fallthrough, in a
          statement switch when you skip the entire switch, you
          fallthrough the entire switch.<br data-mce-bogus="1">
        </div>
        <div><br data-mce-bogus="1">
        </div>
        <div>So we keep supporting the traditional partial switch with
          no modification but requires if a user wants a partial arrow
          switch, to add a "default -> {}".<br>
        </div>
        <div><br data-mce-bogus="1">
        </div>
        <div>This is an incompatible change with the codes written since
          Java 14 so it's a limited incompatible change.<br
            data-mce-bogus="1">
        </div>
        <div>Perhaps the main blocker is admitting that we were wrong.<br
            data-mce-bogus="1">
        </div>
        <div><br data-mce-bogus="1">
        </div>
        <div>Rémi</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>De:
            </b>"Brian Goetz" <a class="moz-txt-link-rfc2396E" href="mailto:brian.goetz@oracle.com"><brian.goetz@oracle.com></a><br>
            <b>À: </b>"amber-spec-experts"
            <a class="moz-txt-link-rfc2396E" href="mailto:amber-spec-experts@openjdk.java.net"><amber-spec-experts@openjdk.java.net></a><br>
            <b>Envoyé: </b>Lundi 31 Août 2020 15:25:13<br>
            <b>Objet: </b>Re: [pattern-switch] Opting into totality<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;">I
            think this is the main open question at this point.  
            <div class=""><br class="">
            </div>
            <div class="">We now have a deeper understanding of what
              this means, and the shape of the remainder.  Totality
              means not only “spot check me that I’m right”, but also “I
              know there might be some remainder, please deal with it.”
                So totality is not merely about type checking, but about
              affirmative handling of the remainder.  </div>
            <div class=""><br class="">
            </div>
            <div class="">Expression switches automatically get  this
              treatment, and opting _out_ of that makes no sense for
              expression switches (expressions must be total), but
              statement switches make sense both ways (just like
              unbalanced and balanced if-else.)  Unfortunately the
              default has to be partial,  so the main question is, how
               do we indicate the desire for totality in a way that is
              properly evocative for the user?  </div>
            <div class=""><br class="">
            </div>
            <div class="">We’ve talked about modifying switch (sealed
              switch), a hyphenated keyword (total-switch), a trailing
              modifier (switch case), and synthetic cases (“default:
              unreachable”).  Of course at this point it’s “just
              syntax”, but I think our goal should be picking something
              that  makes it obvious to users that what’s going on is
              not merely an assertion of totality, but also a desire to
              handle the remainder.  <br class="">
              <div><br class="">
                <blockquote class="">
                  <div class=""><span style="font-family: monospace;
                      font-size: large;" class="">   - How does a switch
                      opt into totality, other than by being an
                      expression switch?</span></div>
                </blockquote>
              </div>
              <br class="">
            </div>
            <br>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>