<div dir="ltr"><div dir="ltr">Hello Stephen!<div>In your essay, you write:</div><div>"A number held as a long is very different to a number held as an int, even if the number has the same magnitude."</div><div>The only difference I can think of about the behaviour is around overflow or underflow -- because, say, INT_MAX + 1 would give a different result than ((long) INT_MAX) + 1.</div><div>What other differences am I missing?</div><div>I'm unsure how these arguments stand when we go all the way down to the world where a number held as an int in Java is in fact held in a machine register which is long-wide.</div><div>Atte.</div><div>Pedro. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em qua., 15 de out. de 2025 às 03:35, Stephen Colebourne <<a href="mailto:scolebourne@joda.org" target="_blank">scolebourne@joda.org</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In the vein of JEP feedback, I believe it makes sense to support<br>
primitive types in pattern matching, and will make sense to support<br>
value types in the future. And I can see the great work that has been<br>
done so far to enable this.<br>
<br>
Unfortunately, I hate the proposed syntactic approach in JEP 507. It<br>
wasn't really clear to me as to *why* I hated the syntax until I had<br>
enough time to really think through what Java does in the area of<br>
primitive type casts, and why extending that as-is to pattern matching<br>
would IMO be a huge mistake.<br>
<br>
(Please note that I fully grasp the pedagogical approach wrt<br>
instanceof defending an unsafe cast, but no matter how much it is<br>
repeated, I don't buy it, and I don't believe it is good enough by<br>
itself.)<br>
<br>
To capture my thoughts, I've written up how Java's current approach to<br>
casts leads me to an alternative proposal - type conversion casts, and<br>
type conversion patterns:<br>
<a href="https://tinyurl.com/typeconvertjava1" rel="noreferrer" target="_blank">https://tinyurl.com/typeconvertjava1</a><br>
<br>
thanks<br>
Stephen</blockquote></div>
</div>