<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>"Kevin Bourrillion" <kevinb@google.com><br><b>To: </b>"Per-Ake Minborg" <per-ake.minborg@oracle.com><br><b>Cc: </b>"Remi Forax" <forax@univ-mlv.fr>, "Angelos Bimpoudis" <angelos.bimpoudis@oracle.com>, "amber-dev" <amber-dev@openjdk.org><br><b>Sent: </b>Thursday, January 26, 2023 9:54:47 PM<br><b>Subject: </b>Re: Draft JEP on Primitive types in patterns, instanceof, and switch<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;"><div dir="ltr">Depending on float equality is *dangerous*, but doesn't completely lack valid use cases.<br><div>Doing so in this manner doesn't seem fundamentally different from all the other ways you can do it too; in my world, *any* of these ways will earn you a static analysis warning. The user can suppress that, and I think this is a wholly reasonable arrangement.</div></div></blockquote><div><br></div><div>I agree apart on the idea of having to rely on a static analysis tool. I still remember the time before Java 1.5 where there was no warning.</div><div>I would prefer a feature just released to not require a new static analysis.</div><div><br data-mce-bogus="1"></div><div>Anyway, that does not solve the issue raised by Guy, can case 0.0 and case -0.0 be both present in a same switch ?<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;"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 26, 2023 at 9:26 AM Per-Ake Minborg <<a href="mailto:per-ake.minborg@oracle.com" target="_blank">per-ake.minborg@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg7312763642421692590">




<div dir="ltr">
<div><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">Maybe certain values for float and double should
 be allowable (e.g. NaN (matching all variants), POSITIVE_INFINITY, NEGATIVE_INFINITY and zero (matching any zero value))? These are clearly defined. All other values would render a compile-time error? (many question marks here) /P</span></div>

<hr style="display:inline-block;width:98%">
<div id="m_8036610084765466172divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> amber-dev <<a href="mailto:amber-dev-retn@openjdk.org" target="_blank">amber-dev-retn@openjdk.org</a>> on behalf of Remi Forax <<a href="mailto:forax@univ-mlv.fr" target="_blank">forax@univ-mlv.fr</a>><br><b>Sent:</b> Thursday, January 26, 2023 2:15 PM<br><b>To:</b> Angelos Bimpoudis <<a href="mailto:angelos.bimpoudis@oracle.com" target="_blank">angelos.bimpoudis@oracle.com</a>><br><b>Cc:</b> amber-dev <<a href="mailto:amber-dev@openjdk.org" target="_blank">amber-dev@openjdk.org</a>><br><b>Subject:</b> Re: Draft JEP on Primitive types in patterns, instanceof, and switch</font>
<div> </div>
</div>
<div>
<div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<div><br>
</div>
<div><br>
</div>
<hr id="m_8036610084765466172x_zwchr">
<div>
<blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt">
<b>From: </b>"Angelos Bimpoudis" <<a href="mailto:angelos.bimpoudis@oracle.com" target="_blank">angelos.bimpoudis@oracle.com</a>><br>
<b>To: </b>"amber-dev" <<a href="mailto:amber-dev@openjdk.org" target="_blank">amber-dev@openjdk.org</a>><br>
<b>Sent: </b>Thursday, January 26, 2023 10:48:47 AM<br>
<b>Subject: </b>Draft JEP on Primitive types in patterns, instanceof, and switch<br>
</blockquote>
</div>

<div>
<blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt">
<div style="font-family:"Segoe UI","Segoe UI ","Helvetica Neue",sans-serif;font-size:11pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span style="color:rgb(0,0,0);font-family:"Segoe UI","Segoe UI ","Helvetica Neue",sans-serif;font-size:11pt">Hello all,</span></div>
<div style="font-family:"Segoe UI","Segoe UI ","Helvetica Neue",sans-serif;font-size:11pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span style="color:rgb(0,0,0);font-family:"Segoe UI","Segoe UI ","Helvetica Neue",sans-serif;font-size:11pt"><br></span></div>
<div style="font-family:"Segoe UI","Segoe UI ","Helvetica Neue",sans-serif;font-size:11pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span style="color:rgb(0,0,0);font-family:"Segoe UI","Segoe UI ","Helvetica Neue",sans-serif;font-size:11pt">I would like to share this draft JEP with you about primitive types in patterns, instanceof, and switch:</span></div>
<div style="font-family:"Segoe UI","Segoe UI ","Helvetica Neue",sans-serif;font-size:11pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<div><br>
</div>
<div><a href="https://openjdk.org/jeps/8288476" target="_blank">https://openjdk.org/jeps/8288476</a><br data-mce-bogus="1"></div>
<div><br>
</div>
<div>"Enhance pattern matching by allowing primitive types to appear anywhere in patterns. Extend instanceof to support primitive types, and extend switch to allow primitive constants as case labels."</div>
<div><br>
</div>
<div>Comments very much welcomed!</div>
<div><br>
</div>
<div>Many thanks,</div>
<div>Angelos</div>
<br>
</div>
</blockquote>
<div><br>
</div>
<div>I still think that the semantics proposed for pattern matching on primitive types is useless complexity with the perverse side effect of normalizing the usage of "default" in pattern matching (too many examples of this JEP are using "default") but we already
 discussed that.<br>
</div>
<div><br>
</div>
<div>Allowing switching on double and float constants is just wrong.</div>
<div>Rust is actually trying to remove that feature<br>
</div>
<div>  <a href="https://github.com/rust-lang/rust/issues/41255" target="_blank">https://github.com/rust-lang/rust/issues/41255</a><br>
</div>
<div><br>
</div>
<div>I see no point to make the same mistake.<br>
</div>
<div><br>
</div>
<div>Otherwise, the rest is fine.<br>
</div>
<div><br>
</div>
<div>Rémi<br>
</div>
<div><br>
</div>
</div>
</div>
</div>
</div>

</div></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="line-height:1.5em;padding-top:10px;margin-top:10px;color:rgb(85,85,85);font-family:sans-serif"><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Kevin Bourrillion |</span><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Java Librarian |</span><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(0,153,57);padding-top:2px;margin-top:2px"> Google, Inc. |</span><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(238,178,17);padding-top:2px;margin-top:2px"><a href="mailto:kevinb@google.com" target="_blank">kevinb@google.com</a></span><br data-mce-bogus="1"></div></div></div></div></div></div></div><br></blockquote></div></div></body></html>