runtime

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToMapKey

func ToMapKey(o *Object) string

Types

type Closure

type Closure interface {
	Eval(args ...*Object) *Object
	EvalIsolated(args ...*Object) *Object
	GetParams() []checker.Parameter
}

type Object

type Object struct {
	// contains filtered or unexported fields
}

func Make

func Make(val any, of checker.Type) *Object

func MakeBool

func MakeBool(b bool) *Object

func MakeDynamic

func MakeDynamic(val any) *Object

func MakeErr

func MakeErr(err *Object) *Object

create Result::Err

func MakeFloat

func MakeFloat(f float64) *Object

func MakeInt

func MakeInt(i int) *Object

func MakeList

func MakeList(of checker.Type, items ...*Object) *Object

func MakeMap

func MakeMap(keyType, valueType checker.Type) *Object

func MakeNone

func MakeNone(of checker.Type) *Object

func MakeOk

func MakeOk(err *Object) *Object

create Result::Ok

func MakeStr

func MakeStr(s string) *Object

func MakeStruct

func MakeStruct(of checker.Type, fields map[string]*Object) *Object

func Void

func Void() *Object

func (Object) AsBool

func (o Object) AsBool() bool

func (Object) AsFloat

func (o Object) AsFloat() float64

func (Object) AsInt

func (o Object) AsInt() int

func (*Object) AsList

func (o *Object) AsList() []*Object

func (*Object) AsMap

func (o *Object) AsMap() map[string]*Object

func (Object) AsString

func (o Object) AsString() string

func (*Object) Copy

func (o *Object) Copy() *Object

deep copies an object

func (Object) Equals

func (o Object) Equals(other Object) bool

simply compares the raw representations.

the checker rules should prevent more complex comparisons.

func (*Object) GoValue

func (o *Object) GoValue() any

Get the Go value. useful for encoding out and scripting results

func (Object) IsErr

func (o Object) IsErr() bool

func (Object) IsFloat

func (o Object) IsFloat() bool

func (Object) IsInt

func (o Object) IsInt() (int, bool)

func (Object) IsNone

func (o Object) IsNone() bool

func (Object) IsOk

func (o Object) IsOk() bool

func (Object) IsResult

func (o Object) IsResult() bool

func (Object) IsStr

func (o Object) IsStr() (string, bool)

func (Object) IsStruct

func (o Object) IsStruct() bool

func (*Object) List_Push

func (o *Object) List_Push(item *Object)

func (Object) Map_GetKey

func (o Object) Map_GetKey(str string) *Object

Ard primitives can be used as keys. The raw representation is a string, so convert the string from Go back to Ard

func (*Object) Map_Set

func (o *Object) Map_Set(key, val *Object) bool

map_set sets a key-value pair in the map object. returns true if successful, false otherwise.

func (*Object) MarshalJSON

func (o *Object) MarshalJSON() ([]byte, error)

MarshalJSON implements the traditional JSON marshaling interface

func (*Object) MarshalJSONTo

func (o *Object) MarshalJSONTo(enc *jsontext.Encoder) error

MarshalJSONTo implements JSON v2 marshaling interface

func (Object) Raw

func (o Object) Raw() any

func (*Object) Set

func (o *Object) Set(v any)

mutate the inner representation

func (*Object) SetRefinedType

func (o *Object) SetRefinedType(declared checker.Type)

todo: eliminating unknown generics in the checker needs more work, particularly for nested scopes - see decode::nullable

  • the checker successfully refines on variable definitions
  • it does not work on chained expressions let result = returns_generic() result.expect("foobar").do_stuff() // .expect(...) returns an open generic

func (Object) String

func (o Object) String() string

func (Object) Struct_Get

func (o Object) Struct_Get(key string) *Object

func (Object) ToNone

func (o Object) ToNone() *Object

func (Object) ToSome

func (o Object) ToSome(val any) *Object

create a Maybe::Some from an existing Maybe

func (Object) Type

func (o Object) Type() checker.Type

func (*Object) UnwrapResult

func (o *Object) UnwrapResult() *Object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL