<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4"><font face="monospace">Yes, many languages that have
pattern matching allow constant literals to be used as patterns
("constant patterns"), so <br>
<br>
case Point(0, _): <br>
<br>
would match any point on the X axis. The example Swaranga gave
used constant patterns in this way, but that is orthogonal to
the question being posed, which was about switching over
multiple values at once. <br>
<br>
Constant patterns have been discussed in early pattern matching
writeups; we have left them on the "maybe for later" list, for a
few reasons (and I'm glad we did.) They may come into the
lineup at some point, but in the meantime, there are
higher-leverage features ahead of it.<br>
<br>
<br>
</font></font><br>
<div class="moz-cite-prefix">On 4/23/2023 1:18 PM, David Alayachew
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAA9v-_NkHj6WatxJS-+tJOjZpPwmg=wZQ7z8HoqiiZvNYjr4eg@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">Hello,</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">For
whatever reason, I remember seeing this as another potential
future direction for Java.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">$
build/windows-x86_64-server-release/images/jdk/bin/jshell
--enable-preview<br>
| Welcome to JShell -- Version 21-internal<br>
| For an introduction type: /help intro<br>
<br>
jshell> sealed interface ABC {<br>
...> enum A implements ABC {Z}<br>
...> record B(A a) implements ABC {}<br>
...> record C(A a, B b) implements ABC {}<br>
...> }<br>
| created interface ABC<br>
<br>
jshell> final ToIntFunction<ABC> d =<br>
...> abc -><br>
...> switch (abc) {<br>
...> case C(A.Z, B(A.Z)) -> 1;<br>
...> default -> 0;<br>
...> };</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">I think
it was called constant patterns?</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">Thank
you for your time!</div>
<div class="gmail_default" style="font-family:monospace">David
Alayachew<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>