class Ven::Suite::Context::Machine

Overview

The context for a Machine.

Defined in:

ven/suite/context.cr

Constant Summary

MAX_TRACES = 64

Maximum amount of traceback entries. Clears the traces if exceeds.

Instance Method Summary

Instance Method Detail

def [](symbol : String | VSymbol) #

Returns the value of a symbol.

Raises if symbol was not found.


[View source]
def []=(symbol : String, value : Model, nest = -1) #

Makes symbol be value in the localmost scope.

If the localmost scope includes a metacontext ($), and that metacontext has a field named symbol, this field will be set to value instead.

Will raise VenAssignmentError if symbol already exists and is an MFunction, whilst value is not.


[View source]
def []=(symbol : VSymbol, value : Model) #

Makes symbol be value in its nest, or, if no nest specified, in the localmost scope.


[View source]
def []?(symbol : String, maybe = nil) #

Returns the value of symbol.

Respects the metacontext ($).

Nests maybe and -1 will be searched in first.

Returns nil if symbol was not found.


[View source]
def []?(symbol : VSymbol) #

Returns the value of symbol.

Respects the metacontext ($).

Returns nil if symbol was not found.


[View source]
def clear #

Deletes all scopes except the globalmost.


[View source]
def pop #

Pops the current scope and the current trace.


[View source]
def push(file, line, name) #

Introduces a child scope and a child trace.

Deletes all existing traces if the amount of them exceeds MAX_TRACES.


[View source]
def scopes : Array(Scope) #

The scopes of this context.


[View source]
def size(*args, **options) #

Returns the amount of scopes (aka scope depth, nesting) in this context.


[View source]
def size(*args, **options, &) #

Returns the amount of scopes (aka scope depth, nesting) in this context.


[View source]
def traces : Array(Ven::Suite::Trace) #

The traceback of this context.


[View source]