Alis for update.
Returns the current value of this Local
.
Execute a block with a specific local value, restoring the current state upon completion.
Execute a block with the Local
cleared, restoring the current
state upon completion.
Clear the Local's value.
Alias for apply.
Updates the value of this Local
.
Returns the current value of this Local
, or None
in
case this local should fallback to the default.
Returns the current value of this Local
, or None
in
case this local should fallback to the default.
Use apply in case automatic fallback is needed.
Updates the current value of this Local
.
A
Local
is a ThreadLocal whose scope is flexible. The state of all Locals may be saved or restored onto the current thread by the user. This is useful for threading Locals through execution contexts.Because it's not meaningful to inherit control from two places, Locals don't have to worry about having to merge two contexts.
Note: the implementation is optimized for situations in which save and restore optimizations are dominant.