DynVar type

Per-thread variable

Constructors

DynVar(t:Type) Source: stdlib.ngs:5840
DynVar of the type t: the same instance for the same t

Example

DynVar(Namespace).get(null)  # The namespace being defined, or null

Methods

==(a:DynVar, b:DynVar) Source: stdlib.ngs:5864
Defined as a === b

Returns

Bool
get(dv:DynVar) Source: stdlib.ngs:5852
Get the innermost bound value. Throws LookupFail when nothing is bound.
get(dv:DynVar, dflt:Any) Source: stdlib.ngs:5857
Get the innermost bound value

Returns

The value, or dflt when nothing is bound
init(dv:DynVar, cross_require:Bool=false) Source: stdlib.ngs:5835
DynVar constructor
run(dv:DynVar, val:Any, body:Fun) Source: stdlib.ngs:5846
Run body with dv bound to val.

Returns

Whatever body call returns

Example

dv = DynVar(); dv.run(1, { dv.get() })  # 1