<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 21/05/2025 18:06, Paul Sandoz wrote:<br>
</div>
<blockquote type="cite" cite="mid:A7867680-E127-43E8-BB03-8539A86A9ADC@oracle.com">
<pre>It was a design choice to be consistent with each json value having an
X, accepting X in on construction and producing X out (notionally) on
deconstruction, which leans into pattern matching. Definitely pros/cons
to that e.g., we could instead make JonObject implement Map, or do as
you suggest [*], both of which adjust how one reasons about the X in and
X out.</pre>
</blockquote>
<p>I agree with this. When I wrote, I thought that it might be
possible to address some of these use cases using instance pattern
declaration on the array class (e.g. having an instance pattern
that extracts the i-th element of a JSONArray) -- but the instance
pattern proposals we have discussed so far [1] are not powerful
enough to model that use case.</p>
<p>Maurizio</p>
<p>[1] -
<a class="moz-txt-link-freetext" href="https://openjdk.org/projects/amber/design-notes/patterns/towards-member-patterns">https://openjdk.org/projects/amber/design-notes/patterns/towards-member-patterns</a><br>
</p>
</body>
</html>