Function level try recourse directives.
Brian Goetz
brian.goetz at oracle.com
Tue Dec 27 16:25:40 UTC 2022
I think Mark’s solution is quite practical. I think you’re greatly overestimating the benefits (“enormous ergonomic advantage”) of your idea (a common trap to fall into) and enormously^2 underestimating where the bar is for “add features to everyone’s Java.”
On Dec 27, 2022, at 9:16 AM, Red IO <redio.development at gmail.com<mailto:redio.development at gmail.com>> wrote:
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.
On Tue, Dec 27, 2022, 15:07 Mark Raynsford <org.openjdk at io7m.com<mailto:org.openjdk at io7m.com>> wrote:
On 2022-12-27T14:49:13 +0100
Red IO <redio.development at gmail.com<mailto:redio.development at gmail.com>> wrote:
>
> Sometimes we need to initialize something between the resources and we get
> multiple levels of nesting.
> And I was wondering if we could not just lose the block and auto close at
> the end of a method like this :
I work with Vulkan a lot, and that involves a metric ton of closeable
resources that also have to be closed in stack order. I have a
library-level solution for this:
https://www.io7m.com/software/jmulticlose/
--
Mark Raynsford | https://www.io7m.com<https://www.io7m.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20221227/3790e39c/attachment-0001.htm>
More information about the amber-dev
mailing list