<html><body><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" <brian.goetz@oracle.com><br><b>To: </b>"Remi Forax" <forax@univ-mlv.fr><br><b>Cc: </b>"amber-spec-experts" <amber-spec-experts@openjdk.java.net><br><b>Sent: </b>Friday, September 9, 2022 10:12:21 PM<br><b>Subject: </b>Re: Primitives in instanceof and patterns<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 have a question about your example.  I'm not trying to be clever
    and play "whatabout", I'm looking for a straight answer why you
    think the two cases are different.  <br>
    <br>
    <blockquote cite="mid:1873318389.2133206.1662737744430.JavaMail.zimbra@u-pem.fr">
      <div><span style="font-size: large;"><span style="font-family:
            monospace;"><br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">If we take a simple example<br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">  record Point(int x, int y) { }<br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">  Point point = ...<br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">  switch(point) {<br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">   case Point(int i, int j) -> ...<br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">   ...<br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">  }<br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;"><br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">let say know that we change Point to use longs<br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">  record Point(long x, long y) { }<br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;"><br></span></span></div>
      <div><span style="font-size: large;"><span style="font-family:
            monospace;">With the semantics you propose, the code still
            compile but the pattern is now transformed to a partial
            pattern that will not match all Points but only the ones
            with x and y in between Integer.MIN_VALUE and
            Integer.MAX_VALUE.</span></span></div>
    </blockquote>
    <br>
    The same is true when I start with<br>
    <br>
         record Foo(String s) { ... }<br>
    <br>
    and later change it to<br>
    <br>
        record Foo(Object s) { ... }<br>
    <br>
    (both are incompatible changes, but we won't dwell on that.)  <br>
    <br>
    My question is: why does it not bother you that use-site patterns
    like `Foo(String s)` are reinterpreted as partial after the String
    -> Object change, but the analogous change with long -> int
    bothers you so much that you'd use it to argue against being able to
    ask whether a long is also an int?  <br>
    <br>
    You obviously think that these two examples are radically
    different.  Can you explain why?  Is it anything more than "that's
    the way its always been"?  <br></blockquote><div><br></div><div>I think i've been a little over my head with this example.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>I've forgotten that in both cases, the patterns move from being a total pattern to be a partial pattern so the enclosing switch will not be exhaustive anymore, thus not compile.<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><div><br data-mce-bogus="1"></div></div></div></body></html>