<div dir="auto">What about a user oriented general View class? A class that can base its data on memory owned by another data structure. You could create a view from a list an array or with a bit of integration with Panama from a memory segment. The view could be mutable or immutable could be subranged without copy and would provide a good return type to pass to untrusted code. The biggest downside would be primitives which would suffer boxing or would require hand specialized versions. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 29, 2022, 16:58 Kasper Nielsen <<a href="mailto:kasperni@gmail.com">kasperni@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, 29 Dec 2022 at 16:46, Markus Karg <<a href="mailto:markus@headcrashing.eu" target="_blank" rel="noreferrer">markus@headcrashing.eu</a>> wrote:<br>
><br>
> Proposal: Optimizing Efficiency using Read-only Arrays<br>
><br>
<br>
There are already two draft JEPs for this:<br>
<br>
<a href="https://openjdk.org/jeps/8261099" rel="noreferrer noreferrer" target="_blank">https://openjdk.org/jeps/8261099</a><br>
<a href="https://openjdk.org/jeps/8261007" rel="noreferrer noreferrer" target="_blank">https://openjdk.org/jeps/8261007</a><br>
<br>
/Kasper<br>
<br>
<br>
/Kasper<br>
</blockquote></div>