Scope

zio.blocks.scope.Scope
See theScope companion class
object Scope

Companion object for Scope, providing the global scope, child scope implementation, and the OpenScope handle.

Attributes

Companion
class
Source
Scope.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Scope.type

Members list

Type members

Classlikes

final class Child[P <: Scope] extends Scope

A child scope created by scoped { ... } or Scope.open.

A child scope created by scoped { ... } or Scope.open.

Child scopes have their own finalizer registry and are linked to a parent scope. When the child closes, its finalizers run in LIFO order. The $[A] type is structurally distinct from the parent's, preventing accidental value mixing at compile time (use Scope.lower to convert explicitly).

Type parameters

P

the concrete type of the parent scope

Value parameters

finalizers

the finalizer registry for this child

owner

opaque reference to the creating thread (used by isOwner)

parent

the parent scope that created this child

unowned

if true, isOwner always returns true (used by Scope.open)

Attributes

Source
Scope.scala
Supertypes
class Scope
trait Finalizer
class Object
trait Matchable
class Any
Self type
Child[P]
case class OpenScope

A handle returned by Scope.open representing an explicitly-managed child scope.

A handle returned by Scope.open representing an explicitly-managed child scope.

Value parameters

close

a function that detaches the child from its parent, runs the child's finalizers in LIFO order, and returns a Finalization collecting any errors

scope

the child scope that was created

Attributes

Source
Scope.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object global extends Scope

The root of all scope hierarchies.

The root of all scope hierarchies.

global is self-referential (parent == this) and never closes under normal operation. Its $[A] is simply A (zero-cost identity). Finalizers registered with global.defer run on JVM shutdown via a shutdown hook. isOwner always returns true.

Attributes

Source
Scope.scala
Supertypes
class Scope
trait Finalizer
class Object
trait Matchable
class Any
Self type
global.type