<div dir="auto">This is a nice workaround but allocates additional resources and adds clutter in form of (still) a level of nesting and an unnecessary collection. Considering that try resource is only a syntactic sugar. It shouldn't be difficult to add this simple addition of syntax to provide this enormous ergonomic advantage. Also I think it's unlikely that try (... ); would find another useful use. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 27, 2022, 15:07 Mark Raynsford <<a href="mailto:org.openjdk@io7m.com">org.openjdk@io7m.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2022-12-27T14:49:13 +0100<br>
Red IO <<a href="mailto:redio.development@gmail.com" target="_blank" rel="noreferrer">redio.development@gmail.com</a>> wrote:<br>
><br>
> Sometimes we need to initialize something between the resources and we get<br>
> multiple levels of nesting.<br>
> And I was wondering if we could not just lose the block and auto close at<br>
> the end of a method like this :<br>
<br>
I work with Vulkan a lot, and that involves a metric ton of closeable<br>
resources that also have to be closed in stack order. I have a<br>
library-level solution for this:<br>
<br>
<a href="https://www.io7m.com/software/jmulticlose/" rel="noreferrer noreferrer" target="_blank">https://www.io7m.com/software/jmulticlose/</a><br>
<br>
-- <br>
Mark Raynsford | <a href="https://www.io7m.com" rel="noreferrer noreferrer" target="_blank">https://www.io7m.com</a><br>
<br>
</blockquote></div>