<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4" face="monospace">Thanks David. People don't always
post their "I tried out the new thing and it worked as advertised"
experiences.<br>
<br>
One thing that is often misunderstood about this JEP is that it is
more about _regularization_ than adding a whizzy cool new feature
(which often causes people to respond with "but I don't see when I
would use it" comments.) The point of "regularization" activities
like this is that sharp edges that we've just gotten used to, can
be handled within the normal framework. When it works right, you
shouldn't notice it at all. <br>
<br>
(Regarding switching over booleans: a useful thought experiment
would be, if we had exhaustive switch expressions over booleans in
1995, would we even have wanted to add a ternary? (It's a thought
experiment, doesn't need to become a discussion here.))<br>
<br>
<blockquote type="cite">
<div class="gmail_default" style="font-family:monospace">error:
duplicate unconditional pattern</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
This error threw me for a loop when I first saw it. </blockquote>
<br>
error: neither throwing nor looping in your example<br>
<br>
Seriously, it is reasonable for the error message to try to
identify which patterns are unconditional. We do this with
overload selection conflicts, with type inference conflicts, and
it seems reasonable to do so with pattern conflicts as well.<br>
</font><br>
<br>
<div class="moz-cite-prefix">On 11/25/2024 11:58 PM, David Alayachew
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAA9v-_N5xOJ6GHhaP7uYEwS_4PFRHkrGCw_-iBVXvdiD8GYtgA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">Hello
Amber Dev,<br>
<br>
I just wanted to post my experience with using Primitive
Patterns when trying it out in a non-trivial project.<br>
<br>
First off, one of the things that stood out to me immediately
is how little effort it became to isolate and properly handle
edge cases. Previously, if I wanted to provide a validation
for all the different ways that this int could be wrong, I
would need a separate if statement or a library. Typically, I
would just group all of my checks into a single if check or
boolean, leading to error prone-code. But now, just a simple
when clause on a switch. Then, just throw on the right hand
side for the bad cases, and return itself on the good cases.
My validation code was easier to work with.<br>
<br>
Another thing that I DEEPLY appreciated was the exhaustiveness
checking for boolean. That made a lot of my code a lot more
explicit, which I appreciated. Granted, it ended up being more
verbose, but I don't mind verbosity.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">One
minor annoyance, this one error message was a bit difficult to
follow without looking things up.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">error:
duplicate unconditional pattern</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">This
error threw me for a loop when I first saw it. I NOW know it
is exactly what it means (after having done the necessary
research from the amber docs), but the error message could do
with a bit more context. Maybe clarify which case is the
duplicate? If that's a hard thing to do, then no worries. I
only raise this issue in case the assumption is that the
average Java programmer will look at that error and have a
good idea of what it means without doing a non-trivial amount
of reading.<br>
</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">Honestly,
there's not much else to write. It all just worked. I will
give Primitive Patterns another test in the future, once I
have time.<br>
<br>
Thank you all for your time and attention.<br>
David Alayachew<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>