class Ven::Suite::MBoxInstance

Overview

An instance of an MBox.

Carries with it its own copy of Scope (Context::Machine::Scope), which was created at instantiation, and allows to access the entries of that scope through field access.

Defined in:

ven/suite/model.cr

Constructors

Instance Method Summary

Instance methods inherited from class Ven::Suite::MClass

[]=(referent : Model, value : Model) : Model | Nil []=, []?(index : Int)
[]?(index : Range)
[]?
, callable? : Bool callable?, eqv?(other : Model) : Bool eqv?, false? : Bool false?, field(name : String) : Model | Nil field, indexable? indexable?, length : Int32 length, match(other : Model) match, nth(index : Num)
nth(range : MRange)
nth(other)
nth
, of?(other : MType) : Bool
of?(other : MAny)
of?(other)
of?
, set_referent(referent : Model, value : Model) : Model set_referent, to_bool(inverse = false) : MBool to_bool, to_num : Num to_num, to_str : Str to_str, to_vec : Vec to_vec, true? : Bool true?, weight : MWeight weight

Constructor Detail

def self.new(parent : Ven::Suite::MFunction, namespace : Hash(String, Ven::Suite::MClass | Ven::Suite::MStruct)) #

[View source]

Instance Method Detail

def []=(referent : Str, value : Model) #

Sets referent field of this box instance to value.

If referent is one of the typed fields (i.e., it was declared as a box parameter and thus has a type), a match against that type is performed.


[View source]
def eqv?(other : MBoxInstance) #

Returns whether this box instance is equal to the other box instance.

This box instance and other box instance are equal if and only if their hashes are equal.


[View source]
def eqv?(other : MBox) #

Returns whether this box instance is parented by the other box.


[View source]
def field(name) #

Returns one of the fields in the namespace of this box instance.

Provides two other, model specific and prioritized properties: .name and .parent.


[View source]
def namespace : Context::Machine::Scope #

[View source]
def parent : MFunction #

[View source]
def to_s(io) #

[View source]