Determines if the scope is closed at the instant the effect executes.
Determines if the scope is closed at the instant the effect executes.
Returns an effect that will succeed with true
if the scope is closed,
and false
otherwise.
Determines if the scope is empty (has no finalizers) at the instant the effect executes.
Determines if the scope is empty (has no finalizers) at the instant the
effect executes. The returned effect will succeed with true
if the scope
is empty, and false
otherwise.
Adds a finalizer to the scope.
Adds a finalizer to the scope. If successful, this ensures that when the scope exits, the finalizer will be run, assuming the key has not been garbage collected.
The returned effect will succeed with Right
with a key if the finalizer
was added to the scope or Left
with the value the scope was closed with
if the scope is already closed.
Determines if the scope has been released at the moment the effect is executed executed.
Determines if the scope has been released at the moment the effect is executed executed. A scope can be closed yet unreleased, if it has been extended by another scope which is not yet released.
Prevents a previously added finalizer from being executed when the scope is closed.
Prevents a previously added finalizer from being executed when the scope
is closed. The returned effect will succeed with true
if the finalizer
will not be run by this scope, and false
otherwise.
Extends the specified scope so that it will not be closed until this scope is closed.
Extends the specified scope so that it will not be closed until this scope is closed. Note that extending a scope into the global scope will result in the scope *never* being closed!
Scope extension does not result in changes to the scope contract: open scopes must *always* be closed.
Determines if the scope is open at the moment the effect is executed.
Determines if the scope is open at the moment the effect is executed.
Returns an effect that will succeed with true
if the scope is open,
and false
otherwise.
A
ZScope[A]
is a value that allows adding finalizers identified by a key. Scopes are closed with a value of typeA
, which is provided to all the finalizers when the scope is released.For safety reasons, this interface has no method to close a scope. Rather, an open scope may be required with
ZScope.make
, which returns a function that can close a scope. This allows scopes to be safely passed around without fear they will be accidentally closed.