class Ven::Suite::Context
- Ven::Suite::Context
- Reference
- Object
Overview
The context implements the scope semantics via a scopes
stack, defines the traces stack for tracebacking and the
underscores stack for working with contextual values
(i.e., _
and &_
).
Defined in:
ven/suite/context.crConstructors
Instance Method Summary
-
#[]=(name : String, value : Model)
Binds a new local symbol name to value.
-
#define(name : String, value : Model, local = true, internal = false)
Defines a symbol called name that will hold a value.
-
#fetch(name : String) : Model | Nil
Retrieves a symbol called name.
-
#in(names : Array(String), values : Models, &)
Executes block in a new scope.
-
#in(&)
Executes block in a new empty scope.
-
#in_fun? : Bool
Returns whether the evaluation is currently in a function.
-
#inject(scope : Scope, local = true)
Pushes a scope onto the scopes stack.
-
#scope? : Scope
Returns the localmost scope as a
Scope
. - #traces : Array(Ven::Suite::Trace)
- #traces=(traces : Array(Ven::Suite::Trace))
-
#tracing(trace t : Tuple(QTag, String), &)
Records the evaluation of block as trace and properly disposes of this trace after the block has been executed.
-
#u!(value : Model)
Pushes a value onto the underscores stack.
-
#u?
Pops and returns a value from the underscores stack.
-
#uninject : Scope
Pops a scope from the scopes stack and returns it.
-
#us : Array(Ven::Suite::MClass | Ven::Suite::MStruct)
Returns the underscores stack.
-
#with_u(values : Models, &)
Pushes given values onto the underscores stack, evaluates the block and cleans the underscores stack by removing unused values, if any.
Constructor Detail
Instance Method Detail
Binds a new local symbol name to value. Returns value back.
Defines a symbol called name that will hold a value. If same-named symbol with local set to false already exists (local prior to global), redefines this symbol to henceforth hold value.
Retrieves a symbol called name. It looks for it in the localmost scope first, then proceeds up to the parenting scopes.
Executes block in a new scope. names and values are names and values the new scope will be initialized with.
Pushes a scope onto the scopes stack. Makes all symbols' local be local.
Records the evaluation of block as trace and properly disposes of this trace after the block has been executed.
Returns the underscores stack.
Pushes given values onto the underscores stack, evaluates the block and cleans the underscores stack by removing unused values, if any.