rt

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 44 Imported by: 0

Documentation

Overview

Code generated by `lginterop -packages github.com/zeebo/xxh3`. DO NOT EDIT.

Index

Constants

View Source
const NameCoreNS = "core"

Variables

View Source
var (
	ReadableProto *vm.Protocol // method: -make-reader [x] → reader
	WritableProto *vm.Protocol // method: -make-writer [x] → writer
)

IReadable and IWritable are the IO coercion protocols. Extending these allows user-defined types to participate in the IO system.

View Source
var (
	Version = "dev"
	Commit  = "none"
)

Version and Commit are set by lg.go from goreleaser ldflags at startup.

View Source
var AsyncSrc string
View Source
var CheckSrc string
View Source
var CoreCompiledLGB []byte
View Source
var CoreNS *vm.Namespace
View Source
var CoreSrc string
View Source
var CurrentNS *vm.Var
View Source
var DataSrc string
View Source
var EdnSrc string
View Source
var GoASTType *theGoASTType = &theGoASTType{}
View Source
var GraphSrc string
View Source
var HashSrc string
View Source
var IRBuildSrc string
View Source
var IRDataSrc string
View Source
var IRDominanceSrc string
View Source
var IRDumpSrc string
View Source
var IRLowerGoSrc string
View Source
var IRLowerSrc string
View Source
var IRPassCSESrc string
View Source
var IRPassConstFoldSrc string
View Source
var IRPassDCESrc string
View Source
var IRPassInferArgTypesSrc string
View Source
var IRPassLICMSrc string
View Source
var IRPassMutabilitySrc string
View Source
var IRPassPipelineSrc string
View Source
var IRPassTraceSrc string
View Source
var IRPassTypeInferSrc string
View Source
var IRPassesSrc string
View Source
var IRValidateSrc string

force-rebuild-marker-2

View Source
var IRZipperSrc string
View Source
var IoSrc string
View Source
var PprintSrc string
View Source
var SetSrc string
View Source
var StringSrc string
View Source
var TestSrc string
View Source
var WalkSrc string
View Source
var ZipSrc string

Functions

func AddValue added in v1.9.0

func AddValue(a, b vm.Value) vm.Value

func AllNSes

func AllNSes() map[string]*vm.Namespace

func BoxNativeFn added in v1.9.0

func BoxNativeFn(fn any) vm.Value

BoxNativeFn wraps a Go function literal as a let-go callable. Lowered Go closures use this at the runtime boundary after capturing outer Go locals directly.

func BoxRestArgs added in v1.9.0

func BoxRestArgs(args []vm.Value) vm.Value

BoxRestArgs boxes a variadic rest-args slice into a vm.Value list. Used by the Go lowering when lowering :load-arg for the rest arg of a variadic function (where the Go param is ...vm.Value).

func ClearTaps added in v1.9.0

func ClearTaps()

ClearTaps drops every registered tap fn. `add-tap` appends to a process-global slice with no automatic removal, so a test that taps without `remove-tap` (e.g. clojure-test-suite's taps.cljc) leaks its tap closure — and, because all of a compile pass's fns share one vm.Consts, the closure pins that whole constant pool. Re-running the suite in a loop (BenchmarkClojureTestSuite) thus accumulates ~one Consts pool per iteration. The bench calls this between iterations to keep that from growing unboundedly.

func DefNSBare added in v1.3.0

func DefNSBare(name string) *vm.Namespace

DefNSBare creates and registers a minimal namespace (with CoreNS refer) without triggering the loader. Used during bytecode decoding to create var homes for not-yet-loaded namespaces.

func DumpNamespaces

func DumpNamespaces(fileName string)

func EDNEncodeArgs added in v1.1.0

func EDNEncodeArgs(args []vm.Value) (string, error)

EDNEncodeArgs encodes args as an EDN vector string.

func EmbeddedNSNames added in v1.9.0

func EmbeddedNSNames() []string

EmbeddedNSNames returns every embedded namespace name (dotted form), derived from the embedded file tree. Used by lgbgen to discover what to precompile.

func EmbeddedSource added in v1.9.0

func EmbeddedSource(name string) (string, bool)

EmbeddedSource returns the source of an embedded namespace by its dotted ns name.

Naming rule (mirrors `cmd/lgbgen.nsToGoPkgName` direction-flipped):

  • dots are path separators: `ir.passes.dce` → `ir/passes/dce.lg`
  • in the *leaf* segment, hyphens map to underscores so the file name is a legal Go-style identifier: `ir.lower-go` → `ir/lower_go.lg`

Returns ("", false) if no matching file exists.

func FuzzyNamespacedSymbolLookup

func FuzzyNamespacedSymbolLookup(currentNS *vm.Namespace, s vm.Symbol) []vm.Symbol

func GeValue added in v1.9.0

func GeValue(a, b vm.Value) bool

func GtValue added in v1.9.0

func GtValue(a, b vm.Value) bool

func InvokeValue added in v1.9.0

func InvokeValue(target vm.Value, args []vm.Value) (vm.Value, error)

InvokeValue applies a runtime callable using let-go's dynamic invocation path.

func JSONDecodeValue added in v1.1.0

func JSONDecodeValue(s string) (vm.Value, error)

JSONDecodeValue decodes a JSON string into a vm.Value.

func JSONEncodeArgs added in v1.1.0

func JSONEncodeArgs(args []vm.Value) (string, error)

JSONEncodeArgs encodes args as a plain JSON array string.

func LeValue added in v1.9.0

func LeValue(a, b vm.Value) bool

func LookupNS added in v1.3.0

func LookupNS(name string) *vm.Namespace

func LookupOrRegisterNS

func LookupOrRegisterNS(name string) *vm.Namespace

func LookupOrRegisterNSNoLoad

func LookupOrRegisterNSNoLoad(name string) *vm.Namespace

func LookupVar added in v1.9.0

func LookupVar(nsName, symName string) *vm.Var

LookupVar resolves a runtime Var by namespace and symbol name.

func LtValue added in v1.9.0

func LtValue(a, b vm.Value) bool

func MakeNativeMultiArity added in v1.9.0

func MakeNativeMultiArity(fns []vm.Value) vm.Value

MakeNativeMultiArity combines native-lowered function branches into a runtime multi-arity callable.

func MarkNSNeedsLoad added in v1.3.0

func MarkNSNeedsLoad(name string)

MarkNSNeedsLoad flags a namespace as needing on-demand loading even though it already exists in the registry (created during bytecode decoding).

func MulValue added in v1.9.0

func MulValue(a, b vm.Value) vm.Value

func NS

func NS(name string) *vm.Namespace

func QuotValue added in v1.9.0

func QuotValue(a, b vm.Value) vm.Value

func RegisterInstaller added in v1.9.0

func RegisterInstaller(fn func())

RegisterInstaller queues fn to be called from lang.go's init(). Call this from your file's init() — it is not safe to call after init has run.

func RegisterNS

func RegisterNS(namespace *vm.Namespace) *vm.Namespace

func RequireNS added in v1.9.0

func RequireNS(name string) (*vm.Namespace, error)

RequireNS loads/materializes a namespace and reports an error when a loader is configured but the namespace could not be loaded. RequireNS loads/materializes a namespace and reports an error if a loader is configured but the namespace could not be loaded. Returns nil namespace on error (no half-initialized placeholder is leaked).

func SetEvalInNS added in v1.1.0

func SetEvalInNS(fn func(string, *vm.Namespace) (vm.Value, error))

SetEvalInNS sets the namespace-aware eval function.

func SetNSLoader

func SetNSLoader(loader NSLoader)

func SetReadEDN added in v1.1.0

func SetReadEDN(fn func(string) (vm.Value, error))

SetReadEDN sets the EDN reader function (called by compiler package).

func ShutdownAllPods added in v1.1.0

func ShutdownAllPods()

ShutdownAllPods gracefully shuts down all loaded pods.

func SubValue added in v1.9.0

func SubValue(a, b vm.Value) vm.Value

func TransitDecodeValue added in v1.1.0

func TransitDecodeValue(s string) (vm.Value, error)

TransitDecodeValue decodes a transit+json payload string.

func TransitEncodeArgs added in v1.1.0

func TransitEncodeArgs(args []vm.Value) (string, error)

TransitEncodeArgs encodes a list of args for pod invocation.

Types

type FileStat

type FileStat struct {
	Name    string `letgo:"name"`
	Size    int64  `letgo:"size"`
	IsDir   bool   `letgo:"dir?"`
	ModTime string `letgo:"mod-time"`
}

FileStat is the struct behind os/stat return values.

type HTTPRequest

type HTTPRequest struct {
	RequestMethod string   `letgo:"request-method"`
	Scheme        string   `letgo:"scheme"`
	URI           string   `letgo:"uri"`
	Path          string   `letgo:"path"`
	QueryString   string   `letgo:"query-string"`
	Body          string   `letgo:"body"`
	RemoteAddr    string   `letgo:"remote-addr"`
	ServerAddr    string   `letgo:"server-addr"`
	ServerPort    string   `letgo:"server-port"`
	ContentType   string   `letgo:"content-type"`
	Headers       vm.Value `letgo:"headers"`
}

HTTPRequest is the struct behind ring-style HTTP request maps.

type HTTPResponse

type HTTPResponse struct {
	Status  int      `letgo:"status"`
	Body    vm.Value `letgo:"body"`
	Headers vm.Value `letgo:"headers"`
}

HTTPResponse is the struct behind HTTP client response maps.

type Handler

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

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(resp http.ResponseWriter, request *http.Request)

type IOHandle

type IOHandle struct {
	File *os.File
	// contains filtered or unexported fields
}

IOHandle wraps an *os.File with optional buffered reader for line-based reads.

func NewIOHandle

func NewIOHandle(f *os.File) *IOHandle

func (*IOHandle) Close

func (h *IOHandle) Close() error

func (*IOHandle) Reader

func (h *IOHandle) Reader() *bufio.Reader

func (*IOHandle) String

func (h *IOHandle) String() string

type LGBuffer

type LGBuffer struct {
	Buf *bytes.Buffer
}

LGBuffer wraps bytes.Buffer as a readable/writable value.

func (*LGBuffer) Read

func (b *LGBuffer) Read(p []byte) (int, error)

func (*LGBuffer) String

func (b *LGBuffer) String() string

func (*LGBuffer) Write

func (b *LGBuffer) Write(p []byte) (int, error)

type LGReader

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

LGReader wraps any io.Reader with optional buffering and close.

func (*LGReader) Buffered

func (r *LGReader) Buffered() *bufio.Reader

func (*LGReader) Close

func (r *LGReader) Close() error

func (*LGReader) Read

func (r *LGReader) Read(p []byte) (int, error)

func (*LGReader) String

func (r *LGReader) String() string

type LGURL

type LGURL struct {
	Scheme   string `letgo:"scheme"`
	Host     string `letgo:"host"`
	Port     string `letgo:"port"`
	Path     string `letgo:"path"`
	Query    string `letgo:"query"`
	Fragment string `letgo:"fragment"`
	UserInfo string `letgo:"user-info"`
	Raw      string `letgo:"raw"`
}

LGURL represents a parsed URL as a record.

type LGWriter

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

LGWriter wraps any io.Writer with optional buffering and close.

func (*LGWriter) Buffered

func (w *LGWriter) Buffered() *bufio.Writer

func (*LGWriter) Close

func (w *LGWriter) Close() error

func (*LGWriter) Flush

func (w *LGWriter) Flush() error

func (*LGWriter) String

func (w *LGWriter) String() string

func (*LGWriter) Write

func (w *LGWriter) Write(p []byte) (int, error)

type Mult

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

Mult broadcasts values from a source channel to multiple tap channels.

type NSLoader

type NSLoader interface {
	Load(string) *vm.Namespace
}

func GetNSLoader added in v1.5.0

func GetNSLoader() NSLoader

type Pod added in v1.1.0

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

Pod represents a running babashka pod subprocess.

func (*Pod) Invoke added in v1.1.0

func (p *Pod) Invoke(varName string, args []vm.Value) (vm.Value, error)

Invoke calls a pod var and returns the result (synchronous).

func (*Pod) InvokeAsync added in v1.1.0

func (p *Pod) InvokeAsync(varName string, args []vm.Value) (vm.Chan, error)

InvokeAsync calls a pod var and sends results to a channel. The channel stays open for streaming - the pod sends multiple values with the same id.

func (*Pod) Shutdown added in v1.1.0

func (p *Pod) Shutdown()

Shutdown sends shutdown op if supported and waits for process to exit.

type PromiseChan added in v1.9.0

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

PromiseChan implements clojure.core.async's promise-chan: a channel that caches the FIRST value put to it and replays that value to every taker, forever. Subsequent puts are dropped; closing without a value makes takers receive nil; closing after a value is a no-op (the value keeps being served).

Unlike a raw vm.Chan it STORES the value rather than transferring it, which is what makes the semantics correct: with a single raw channel a taker parked before the first put could steal that put before it was cached, so later takers would never see it. Storing the value behind a latch removes that race entirely.

Dispatched to by >! / <! / close! when they receive a boxed *PromiseChan instead of a vm.Chan. Methods are unexported so the reflective method-boxing in vm.NewBoxed skips them.

type Pub

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

Pub routes values from a source channel to subscribers by topic.

type ShellResult

type ShellResult struct {
	Exit int    `letgo:"exit"`
	Out  string `letgo:"out"`
	Err  string `letgo:"err"`
}

ShellResult is the struct behind os/sh return values.

type SpawnResult added in v1.4.0

type SpawnResult struct {
	Pid  int    `letgo:"pid"`
	Exit int    `letgo:"exit"`
	Out  string `letgo:"out"`
	Err  string `letgo:"err"`
}

SpawnResult is the struct behind syscall/spawn return values.

type TransitDecoder added in v1.1.0

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

TransitDecoder decodes transit+json into vm.Values.

func NewTransitDecoder added in v1.1.0

func NewTransitDecoder() *TransitDecoder

NewTransitDecoder creates a new decoder with a fresh cache.

func (*TransitDecoder) Decode added in v1.1.0

func (d *TransitDecoder) Decode(s string) (vm.Value, error)

Decode parses a transit+json string into a vm.Value.

type TransitEncoder added in v1.1.0

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

TransitEncoder encodes vm.Values to transit+json.

func NewTransitEncoder added in v1.1.0

func NewTransitEncoder() *TransitEncoder

NewTransitEncoder creates a new encoder with a fresh cache.

func (*TransitEncoder) Encode added in v1.1.0

func (e *TransitEncoder) Encode(v vm.Value) (string, error)

Encode encodes a vm.Value to a transit+json string.

func (*TransitEncoder) EncodeList added in v1.1.0

func (e *TransitEncoder) EncodeList(vals []vm.Value) (string, error)

EncodeList encodes a slice of values as a transit list (used for pod args).

type UnameResult added in v1.4.0

type UnameResult struct {
	Sysname  string `letgo:"sysname"`
	Machine  string `letgo:"machine"`
	Release  string `letgo:"release"`
	Nodename string `letgo:"nodename"`
}

UnameResult is the struct behind syscall/uname return values.

type WaitResult added in v1.4.0

type WaitResult struct {
	Pid    int `letgo:"pid"`
	Status int `letgo:"status"`
	Signal int `letgo:"signal"`
}

WaitResult is the struct behind syscall/waitpid return values. Status is the exit code (0-255) for normal exits, -1 for signal deaths. Signal is the terminating signal number (0 when not signal-killed).

Jump to

Keyboard shortcuts

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