Documentation ¶
Index ¶
- Variables
- type Env
- func (e *Env) Addr(symbol string) (reflect.Value, error)
- func (e *Env) Copy() *Env
- func (e *Env) DeepCopy() *Env
- func (e *Env) Define(symbol string, value interface{}) error
- func (e *Env) DefineGlobal(symbol string, value interface{}) error
- func (e *Env) DefineGlobalReflectType(symbol string, reflectType reflect.Type) error
- func (e *Env) DefineGlobalType(symbol string, aType interface{}) error
- func (e *Env) DefineGlobalValue(symbol string, value reflect.Value) error
- func (e *Env) DefineReflectType(symbol string, reflectType reflect.Type) error
- func (e *Env) DefineType(symbol string, aType interface{}) error
- func (e *Env) DefineValue(symbol string, value reflect.Value) error
- func (e *Env) Delete(symbol string)
- func (e *Env) DeleteGlobal(symbol string)
- func (e *Env) Get(symbol string) (interface{}, error)
- func (e *Env) GetEnvFromPath(path []string) (*Env, error)
- func (e *Env) GetValue(symbol string) (reflect.Value, error)
- func (e *Env) NewEnv() *Env
- func (e *Env) NewModule(symbol string) (*Env, error)
- func (e *Env) Set(symbol string, value interface{}) error
- func (e *Env) SetExternalLookup(externalLookup ExternalLookup)
- func (e *Env) SetValue(symbol string, value reflect.Value) error
- func (e *Env) String() string
- func (e *Env) Type(symbol string) (reflect.Type, error)
- type ExternalLookup
Constants ¶
This section is empty.
Variables ¶
var ( // Packages is a where packages can be stored so VM import command can be used to import them. // reflect.Value must be valid or VM may crash. // For nil must use NilValue. Packages = make(map[string]map[string]reflect.Value) // PackageTypes is a where package types can be stored so VM import command can be used to import them // reflect.Type must be valid or VM may crash. // For nil type must use NilType. PackageTypes = make(map[string]map[string]reflect.Type) // NilType is the reflect.type of nil NilType = reflect.TypeOf(nil) // NilValue is the reflect.value of nil NilValue = reflect.New(reflect.TypeOf((*interface{})(nil)).Elem()).Elem() // ErrSymbolContainsDot symbol contains . ErrSymbolContainsDot = errors.New("symbol contains '.'") )
Functions ¶
This section is empty.
Types ¶
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env is the environment needed for a VM to run in.
func (*Env) Addr ¶
Addr returns reflect.Addr of value for first matching symbol found in current or parent scope.
func (*Env) DeepCopy ¶
DeepCopy the Env for current scope and parent scopes. Note that each scope is a consistent snapshot but not the whole.
func (*Env) DefineGlobal ¶
DefineGlobal defines/sets interface value to symbol in global scope.
func (*Env) DefineGlobalReflectType ¶
DefineGlobalReflectType defines type in global scope.
func (*Env) DefineGlobalType ¶
DefineGlobalType defines type in global scope.
func (*Env) DefineGlobalValue ¶
DefineGlobalValue defines/sets reflect value to symbol in global scope.
func (*Env) DefineReflectType ¶
DefineReflectType defines type in current scope.
func (*Env) DefineType ¶
DefineType defines type in current scope.
func (*Env) DefineValue ¶
DefineValue defines/sets reflect value to symbol in current scope.
func (*Env) DeleteGlobal ¶
DeleteGlobal deletes the first matching symbol found in current or parent scope.
func (*Env) GetEnvFromPath ¶
GetEnvFromPath returns Env from path
func (*Env) NewModule ¶
NewModule creates new child scope and define it as a symbol. This is a shortcut for calling e.NewEnv then Define that new Env.
func (*Env) SetExternalLookup ¶
func (e *Env) SetExternalLookup(externalLookup ExternalLookup)
SetExternalLookup sets an external lookup