JEP draft: Scope Locals

Alex Otenko oleksandr.otenko at gmail.com
Sat May 15 09:10:16 UTC 2021


ScopeLocal.where(...).run(...).finally(...) would be nice.

Alex

On Sat, 15 May 2021, 09:16 Andrew Haley, <aph at redhat.com> wrote:

> On 5/15/21 12:28 AM, Nathan Reynolds wrote:
> > What about cleanup of the scoped objects?  For example, how do I ensure
> > close() or some cleanup method is called at the right time on the scoped
> > object?  Do I need to use a Weak/Soft/PhantomReference and a
> ReferenceQueue
> > to track the object?  Do I use Cleaner?  Does the object need to
> implement
> > finalize()... hopefully not?
>
> All a scope local does is bind a value to a name, in a scope. This isn't
> about C++-style destructors, which have their merits but are a different
> subject.
>
> --
> Andrew Haley  (he/him)
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> https://keybase.io/andrewhaley
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>
>


More information about the loom-dev mailing list