<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <font size="4"><font face="monospace">In 14.11.1, you say:<br>
        <br>
        <blockquote type="cite"><strong style="background-color:
            rgb(208, 255, 208); font-weight: inherit; text-decoration:
            underline; color: rgb(0, 0, 0); font-family: "DejaVu
            Sans", "Bitstream Vera Sans", "Luxi
            Sans", Verdana, Arial, Helvetica, sans-serif;
            font-size: 13.3333px; font-style: normal;
            font-variant-ligatures: normal; font-variant-caps: normal;
            letter-spacing: normal; orphans: 2; text-align: left;
            text-indent: 0px; text-transform: none; white-space: normal;
            widows: 2; word-spacing: 0px; -webkit-text-stroke-width:
            0px;">For a case label with case patterns, it is a
            compile-time error if any of its case patterns declares one
            or more pattern variables.</strong></blockquote>
        <br>
        But don't you really mean "For a case label with _more than one_
        case patterns, it is ..."?<br>
        <br>
        I could see this being implicit in the "s" at the end of "case
        patterns", but this would be a pretty subtle distinction.  <br>
        <br>
        The following text has a typo: "more than case patterns" ->
        "more than ONE case pattern".<br>
        <br>
        I see that you've switched horses on domination; now any "dead
        pattern" is an error.  I am fine with this (though Gavin did
        make a good argument for the alternative.)  <br>
        <br>
        In 14.11.1.2, we talk about resolution of patterns.  If any of
        the patterns resolves to an any pattern, then it will dominate
        the others.  I believe this is already handled by the text about
        "if one dominates the others" so that case is already handled,
        good.<br>
        <br>
        You commit here to strict left-to-right evaluation of patterns
        when there are multiple patterns on a case.  This is reasonable,
        but bear in mind that such L2R commitments do potentially
        interfere with folding optimizations if any of the patterns
        involve imperative code such as accessors or deconstructors.  <br>
        <br>
        `when (Boolean) null` -- yuck :)  Well spotted.<br>
        <br>
        The text around any patterns and resolution in 14.30.1 seems
        like it could still be simplified a bit.  <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
      </font></font><br>
    <div class="moz-cite-prefix">On 2/28/2023 11:21 AM, Angelos
      Bimpoudis wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:SA2PR10MB4667FD3C36E5EAB9DAF669B882AC9@SA2PR10MB4667.namprd10.prod.outlook.com">
      
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div class="elementToProof ContentPasted1" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        Updated draft spec. </div>
      <div class="elementToProof ContentPasted1" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <div class="elementToProof ContentPasted1" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        Includes a small number of fixes and a correct "rebase" on top
        of the JLS changes resulting from JEP 432 (Record Patterns
        (Second Preview)) and JEP 433 (Pattern Matching for switch
        (Fourth Preview)) that covers Maurizio's point.</div>
      <div class="elementToProof" style="font-family:"Segoe
        UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <div class="elementToProof ContentPasted0" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <a href="https://cr.openjdk.org/~abimpoudis/unnamed/latest/" data-auth="NotApplicable" id="LPlnk416801" moz-do-not-send="true" class="moz-txt-link-freetext">https://cr.openjdk.org/~abimpoudis/unnamed/latest/</a><br>
      </div>
      <div class="elementToProof ContentPasted0" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <div class="elementToProof ContentPasted0" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        (please note that the based URL has been slightly changed ^^)</div>
      <div class="elementToProof ContentPasted0" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <div class="elementToProof ContentPasted0" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <span class="ContentPasted0 ContentPasted2" style="margin:0px">Comments
          are always very much welcomed!</span><span style="background-color:rgb(255,255,255);
          display:inline!important"></span><br class="Apple-interchange-newline ContentPasted2">
      </div>
      <div class="elementToProof ContentPasted0" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <div class="elementToProof ContentPasted0" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        Best,</div>
      <div class="elementToProof ContentPasted0" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        Angelos</div>
      <div class="elementToProof ContentPasted0" style="font-family:"Segoe UI","Segoe UI Web (West
        European)","Helvetica Neue",sans-serif;
        font-size:11pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <hr tabindex="-1" style="display:inline-block; width:98%">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b>
          Angelos Bimpoudis <a class="moz-txt-link-rfc2396E" href="mailto:angelos.bimpoudis@oracle.com"><angelos.bimpoudis@oracle.com></a><br>
          <b>Sent:</b> 24 February 2023 17:23<br>
          <b>To:</b> Maurizio Cimadamore
          <a class="moz-txt-link-rfc2396E" href="mailto:maurizio.cimadamore@oracle.com"><maurizio.cimadamore@oracle.com></a>; Brian Goetz
          <a class="moz-txt-link-rfc2396E" href="mailto:brian.goetz@oracle.com"><brian.goetz@oracle.com></a>; 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>Subject:</b> Re: Draft JLS Spec about unnamed patterns and
          variables</font>
        <div> </div>
      </div>
      <div dir="ltr">
        <div class="x_elementToProof" style="font-family:"Segoe
          UI","Segoe UI Web (West
          European)","Helvetica Neue",sans-serif;
          font-size:11pt; color:rgb(0,0,0);
          background-color:rgb(255,255,255)">
          <br>
        </div>
        <div class="x_elementToProof" style="font-family:"Segoe
          UI","Segoe UI Web (West
          European)","Helvetica Neue",sans-serif;
          font-size:11pt; color:rgb(0,0,0);
          background-color:rgb(255,255,255)">
          The main takeaways:</div>
        <div style="font-family:"Segoe UI","Segoe UI Web
          (West European)","Helvetica Neue",sans-serif;
          font-size:11pt; color:rgb(0,0,0);
          background-color:rgb(255,255,255)">
          <ul>
            <li class="x_elementToProof x_ContentPasted0
              x_ContentPasted1 x_ContentPasted2">case Number _ can fall
              out to other patterns since it doesn't introduce any
              bindings (adjustment in the spec draft is needed)<br>
            </li>
            <li class="x_elementToProof x_ContentPasted0
              x_ContentPasted1">case Number _ dominates case String
              <span style="background-color:rgb(255,255,255);
                display:inline!important">_</span>, Integer
              <span style="background-color:rgb(255,255,255);
                display:inline!important">_ (adjustment is not needed in
                current draft, but I will double check before I
                circulate the revised version).</span><br>
            </li>
          </ul>
          <div class="x_elementToProof"><span style="background-color:rgb(255,255,255);
              display:inline!important"></span></div>
          <span style="font-size:11pt; margin:0px;
            background-color:rgb(255,255,255)">Thanks for all the
            comments!</span><br>
          <span style="font-size:11pt; margin:0px;
            background-color:rgb(255,255,255)"></span>
          <div><span style="background-color:rgb(255,255,255);
              display:inline!important">
              <blockquote itemscope="" itemtype="https://schemas.microsoft.com/QuotedText" style="border-left:3px solid rgb(200,200,200);
                border-top-color:rgb(200,200,200);
                border-right-color:rgb(200,200,200);
                border-bottom-color:rgb(200,200,200); padding-left:1ex;
                margin-left:0.8ex; color:rgb(102,102,102)">
                Thought experiment: what if we had union type patterns?
                 Then the case label `case String _, Integer _` would be
                like matching the the union type pattern
                `(String|Integer) _`:
                <div><br class="x_ContentPasted3">
                </div>
                <div class="x_ContentPasted3">    case Number n: ...</div>
                <div class="x_ContentPasted3">    case (String|Integer)
                  _: ...</div>
                <div><br class="x_ContentPasted3">
                </div>
                <div class="x_ContentPasted3">Would javac then complain
                  that `String|Integer` could be simplified to just
                  `String` on the bsais of flow analysis?  (IntelliJ
                  would, of course.)
                </div>
                <div><br class="x_ContentPasted3">
                </div>
                <div>I initially thought as Tagir did, but then Gavin
                  turned me around and reminded me that it was not dead
                  code, but unreachable statements that we try to avoid.
                   So now I am torn...<br>
                </div>
              </blockquote>
              <div class="x_elementToProof x_ContentPasted5
                x_ContentPasted6">Would union type patterns imply the
                existence of union types? If yes, then, the second case
                could even exist with a binding, correct? In your
                example the LUB is Object so even the case
                (String|Integer) x : x.getClass() can work. The
                difficult scenario would arise with the <span class="x_ContentPasted7" style="background-color:rgb(255,255,255);
                  display:inline!important">case (Customer|Human) x :
                  x.getName();</span></div>
              <div class="x_elementToProof"><br>
              </div>
              <div class="x_elementToProof x_ContentPasted8">If the
                first case in your example did not introduce a binding,
                would both case be equal with Number | (String |
                Integer)? Union types a la Ceylon support this (<a href="http://web.mit.edu/ceylon_v1.3.3/ceylon-1.3.3/doc/en/spec/html_single/#uniontypes" data-auth="NotApplicable" id="LPlnk473936" moz-do-not-send="true" class="moz-txt-link-freetext">http://web.mit.edu/ceylon_v1.3.3/ceylon-1.3.3/doc/en/spec/html_single/#uniontypes</a>).
                On the other hand in Ceylon, the switch needs to be
                exhaustive <b>and</b>​ all cases need to be disjoint.
                So this switch would be invalid. hm..</div>
              <div class="x_elementToProof"><br>
              </div>
            </span></div>
        </div>
        <hr tabindex="-1" style="display:inline-block; width:98%">
        <div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b>
            Maurizio Cimadamore <a class="moz-txt-link-rfc2396E" href="mailto:maurizio.cimadamore@oracle.com"><maurizio.cimadamore@oracle.com></a><br>
            <b>Sent:</b> 23 February 2023 20:27<br>
            <b>To:</b> Brian Goetz <a class="moz-txt-link-rfc2396E" href="mailto:brian.goetz@oracle.com"><brian.goetz@oracle.com></a>;
            Angelos Bimpoudis <a class="moz-txt-link-rfc2396E" href="mailto:angelos.bimpoudis@oracle.com"><angelos.bimpoudis@oracle.com></a>;
            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>Subject:</b> Re: Draft JLS Spec about unnamed patterns
            and variables</font>
          <div> </div>
        </div>
        <div>
          <p style="margin-top: 0px; margin-bottom: 0px;margin-top: 0px;
            margin-bottom: 0px;">
            <br>
          </p>
          <div class="x_x_moz-cite-prefix">On 23/02/2023 18:46, Brian
            Goetz wrote:<br>
          </div>
          <blockquote type="cite"><font size="4"><font face="monospace">but
                we really wanted the case merging.</font></font></blockquote>
          <p style="margin-top: 0px; margin-bottom: 0px;margin-top: 0px;
            margin-bottom: 0px;">
            <font size="4"><font face="monospace">Gotcha.</font></font></p>
          <p style="margin-top: 0px; margin-bottom: 0px;margin-top: 0px;
            margin-bottom: 0px;">
            <font size="4"><font face="monospace">I just wanted to point
                out that there are two questions here (one about
                fall-through and one about domination), and when reading
                the emails it was not obvious to me that a change in how
                fall-through was defined was being proposed.</font></font></p>
          <p style="margin-top: 0px; margin-bottom: 0px;margin-top: 0px;
            margin-bottom: 0px;">
            <font size="4"><font face="monospace">If merging unrelated
                type tests is a goal, I think there should be an example
                for it in the JEP under "Motivation".</font></font></p>
          <p style="margin-top: 0px; margin-bottom: 0px;margin-top: 0px;
            margin-bottom: 0px;">
            <font size="4"><font face="monospace">Maurizio<br>
              </font></font></p>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>