<div dir="ltr"><div style="font-family:monospace" class="gmail_default">Thanks for the response.</div><div style="font-family:monospace" class="gmail_default"><br></div><div style="font-family:monospace" class="gmail_default">Ok, so there's this term unpacking. And when it's used in reference in patterns, it seems to mean the "export of contents of XYZ". Ok, cool. That makes sense then why a full array load would be an unpacking, while a suffix match is not. One must first unpack to search the tail, so that makes sense. Probably better done as a library anyways, as a user-defined pattern.</div><div style="font-family:monospace" class="gmail_default"><br></div><div style="font-family:monospace" class="gmail_default">I guess I just don't see how a prefix match would be considered an unpacking and not a query. What makes a prefix match an unpacking while a suffix match is a query? I'm not seeing that detail yet. But I do see why a center match is a query. That is unquestionably so.</div><div style="font-family:monospace" class="gmail_default"><br></div><div style="font-family:monospace" class="gmail_default">You mentioned cost model, which is the only thing I can think of that might differentiate it. I don't know the performance characteristics of getting from the front of the array vs the back, so maybe that's the gap in my knowledge that's preventing me from thinking this through? I wouldn't know where to get that info, other than attempt (and likely fail) a benchmark in JMH. But instinct (and informal tests) tells me they are equally as fast -- prefix vs suffix.</div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 3, 2026 at 1:34 AM Brian Goetz <<a href="mailto:brian.goetz@oracle.com" target="_blank">brian.goetz@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 dir="auto">
I invite you to think about how such a thing might be implemented, and what arrays are for, and the question sort of answers itself.
<div><br>
</div>
<div>The built-in patterns are about unpacking: recovering type information, unpacking records into their components, unpacking arrays into their contents. Asking whether an array contains exactly these elements, or even asking that question about a prefix
of the elements, is an unpacking. Searching an array, as would be required by a wild card in the beginning or middle, is valid things to want to do, but it’s not unpacking. (And the cost model would be deceptive.)</div>
<div><br>
</div>
<div>Arrays are a low level, built-in feature of the language, not a database to be queried. <br>
<div><br id="m_7715830053927246274m_-188806420100672628m_-2596562345459131596lineBreakAtBeginningOfSignature">
<div dir="ltr">Sent from my iPad</div>
<div dir="ltr"><br>
<blockquote type="cite">On Feb 3, 2026, at 1:01 AM, David Alayachew <<a href="mailto:davidalayachew@gmail.com" target="_blank">davidalayachew@gmail.com</a>> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">Hello <a class="gmail_plusreply" id="m_7715830053927246274m_-188806420100672628m_-2596562345459131596plusReplyChip-1" href="mailto:amber-dev@openjdk.org" target="_blank">@amber-dev</a>,</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">I was a little surprised that I didn't notice this until now, but when re-reading Brian's <a href="https://mail.openjdk.org/pipermail/amber-spec-observers/2022-September/003635.html" target="_blank">Array Patterns write-up</a>,
I realized that my brain auto-completed something that wasn't actually there.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">In the write-up, there is only the concept of a prefix match or an exact match. But what about a suffix match? Or a "somewhere-in-the-center" match?</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">The original proposal for Array Patterns (that preceded this one) had the "..." syntax, which I mentally auto-completed to be "0 or more elements". Maybe that was a mistake on my part too.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">Anyways, could I get some clarification? Is that intentionally unspecified for now, pending further thought? Or is that something that will be handled else where?</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">And by all means, what is there, I like. It's just that the message calls itself Array Patterns, so my thought is that it would cover all the possible types of matches one might want to do on an array.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">Thank you for your time and help.</div>
<div class="gmail_default" style="font-family:monospace">David Alayachew</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote></div>