Coupling in ExtentLocal

Ron Pressler ron.pressler at
Fri Jul 29 20:37:23 UTC 2022


The difference between ExtentLocals and other TwR constructs is that we’d like to use it for critical, foundational, things where we want guarantees we can rely on, and we haven’t been able to find a way to guarantee them as well as we’d like with TwR, even dynamically.

Yes, we are thinking about a "strong” TwR, but we’re busy with so many things so it might take a while. Until then, we might introduce a weaker, or less trustworthy version of ExtentLocals that uses the existing TwR and wouldn’t be used for critical things, but we think that it’s best to start incubation with just the lambda API and then see what problems are most common/annoying and how we can best address them.

— Ron

On 29 Jul 2022, at 15:35, Holo The Sage Wolf <holo3146 at<mailto:holo3146 at>> wrote:


Thanks for the response Kasper, the reason I sent the mail to core-libs is because JDK-8263012<> is assigned to "core-libs". I added loom-devs to the chain.

What Andrew Haley wrote is correct, it is also correct pretty much for every implementation of `AutoClosable` (although, unlike ExtentLocals, most implementations of AutoClosable will cause resource leak, and ExtentLocal can cause a big logical bug). The idea of `strong try-with-resources` seems to solve the problem (and can force better APIs in other places), is there a conversation about this feature?

Yuval Paz

On Fri, Jul 29, 2022 at 12:15 PM Kasper Nielsen <kasperni at<mailto:kasperni at>> wrote:

On Thu, 28 Jul 2022 at 22:11, Holo The Sage Wolf <holo3146 at<mailto:holo3146 at>> wrote:

I have a question about the proposal, why not allow try-with-resources with this API?


For Loom related questions, loom-dev at<mailto:loom-dev at> is probably a better fit.

The main problem with TWR is that it cannot guard against non-nested use.
Because there are no way to force the user to call close(). See more here [1]



Holo The Wise Wolf Of Yoitsu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the loom-dev mailing list