taming resource scopes

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Jun 2 10:21:00 UTC 2021


On 02/06/2021 09:16, Chris Vest wrote:
> So my point is that Rust and Swift have good reference counting 
> stories because of specific language features, and without similar 
> language features I don't think having a generic or general Arc class 
> in Java will be very helpful.

This is the key observation. Without language help these strategies 
don't go that far.

When I mentioned Arc I was merely observing that the behavior of our 
pseudo reference counting (only for _shared_ scopes) is more similar to 
that - but we clearly don't want to add a general purpose Arc - at least 
not in the scope of this project.

In the case of memory segments, I don't expect these kind of locks to be 
used a lot, honestly. But there are circumstances in which you need to 
prevent a scope from being closed, in a certain region of code. If you 
need that, you can use the acquire/release mechanisms we provide (or the 
scope temporal dependency, which is an higher level way to do the same 
thing).

Maurizio



More information about the panama-dev mailing list