Documentation
¶
Overview ¶
Code generated by `lginterop -packages github.com/zeebo/xxh3`. DO NOT EDIT.
Index ¶
- Constants
- Variables
- func AddValue(a, b vm.Value) vm.Value
- func AllNSes() map[string]*vm.Namespace
- func AllNativeModules() map[string][]*NativeModule
- func ApplyGoOverrides(ns *vm.Namespace)
- func ApplyVarMeta(v *vm.Var, meta vm.Value)
- func BoxNativeFn(fn any) vm.Value
- func BoxRestArgs(args []vm.Value) vm.Value
- func CachedVarFn(ptr **vm.Var, nsName, symName string) vm.Fn
- func ClearTaps()
- func DecodeResourceArchive(blob []byte) (map[string][]byte, error)
- func DefNSBare(name string) *vm.Namespace
- func DivValue(a, b vm.Value) vm.Value
- func DumpNamespaces(fileName string)
- func EDNEncodeArgs(args []vm.Value) (string, error)
- func EmbeddedNSNames() []string
- func EmbeddedSource(name string) (string, bool)
- func EmitVia(ec *vm.ExecContext, name, dataJSON string)
- func EncodeResourceArchive(files map[string][]byte) ([]byte, error)
- func EqValue(a, b vm.Value) bool
- func FuzzyNamespacedSymbolLookup(currentNS *vm.Namespace, s vm.Symbol) []vm.Symbol
- func GeValue(a, b vm.Value) bool
- func GtValue(a, b vm.Value) bool
- func InternVar(nsName, symName string) *vm.Var
- func InvokeValue(target vm.Value, args []vm.Value) (vm.Value, error)
- func InvokeValueEC(ec *vm.ExecContext, target vm.Value, args []vm.Value) (vm.Value, error)
- func JSONDecodeValue(s string) (vm.Value, error)
- func JSONEncodeArgs(args []vm.Value) (string, error)
- func LeValue(a, b vm.Value) bool
- func LookupCoreVar(varName string) *vm.Var
- func LookupHostClass(name string) (vm.Value, bool)
- func LookupNS(name string) *vm.Namespace
- func LookupOrRegisterNS(name string) *vm.Namespace
- func LookupOrRegisterNSNoLoad(name string) *vm.Namespace
- func LookupVar(nsName, symName string) *vm.Var
- func LtValue(a, b vm.Value) bool
- func MakeNativeMultiArity(fns []vm.Value) vm.Value
- func MarkNSNeedsLoad(name string)
- func MulValue(a, b vm.Value) vm.Value
- func MultiFnNativeFrozen(ptr **vm.Var, nsName, symName string) bool
- func NS(name string) *vm.Namespace
- func NormalizeResourceName(name string) (string, bool)
- func QuotValue(a, b vm.Value) vm.Value
- func RegisterGoOverrides(nsName string, defs map[string]vm.Value)
- func RegisterHostClass(name string, v vm.Value)
- func RegisterHostMethod(t vm.ValueType, name vm.Symbol, fn vm.Fn)
- func RegisterInstaller(fn func())
- func RegisterNS(namespace *vm.Namespace) *vm.Namespace
- func RegisterNativeModule(m *NativeModule)
- func RegisterNativeMultiFns(nsName string, names []string)
- func RequireNS(name string) (*vm.Namespace, error)
- func RunExitHooks()
- func SetEvalInNS(fn func(string, *vm.Namespace) (vm.Value, error))
- func SetNSLoader(loader NSLoader)
- func SetReadEDN(fn func(string) (vm.Value, error))
- func SetResourceProvider(p ResourceProvider)
- func ShutdownAllPods()
- func StorageIDFrom(flagID, script, cwd, exePath string) string
- func SubValue(a, b vm.Value) vm.Value
- func TransitDecodeValue(s string) (vm.Value, error)
- func TransitEncodeArgs(args []vm.Value) (string, error)
- func WithinRoot(root, p string) bool
- func WriteToErr(ec *vm.ExecContext, s string) error
- func WriteToOut(ec *vm.ExecContext, s string) error
- type EmbeddedResourceProvider
- type Emitter
- type FSResourceProvider
- type FileStat
- type FileStorage
- type FuncEmitter
- type HTTPRequest
- type HTTPResponse
- type Handler
- type IOHandle
- func (h *IOHandle) Close() error
- func (h *IOHandle) File() *os.File
- func (h *IOHandle) Reader() *bufio.Reader
- func (h *IOHandle) ReaderRaw() io.Reader
- func (h *IOHandle) String() string
- func (h *IOHandle) Sync() error
- func (h *IOHandle) Write(s string) (int, error)
- func (h *IOHandle) Writer() io.Writer
- type KeySource
- type LGBuffer
- type LGReader
- type LGURL
- type LGWriter
- type MemoryStorage
- type MouseEvent
- type Mult
- type NSLoader
- type NativeDirectFn
- type NativeModule
- type Pod
- type PromiseChan
- type Pub
- type Resource
- type ResourceProvider
- type ShellResult
- type SpawnResult
- type Storage
- type TransitDecoder
- type TransitEncoder
- type UnameResult
- type WaitResult
Constants ¶
const NameCoreNS = "core"
Variables ¶
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.
var ( Version = "dev" Commit = "none" )
Version and Commit are set by lg.go from goreleaser ldflags at startup.
var AsyncSrc string
var CheckSrc string
var CoreCompiledLGB []byte
var CoreNS *vm.Namespace
var CoreSrc string
var CurrentNS *vm.Var
var DataSrc string
var EdnSrc string
var GoASTType *theGoASTType = &theGoASTType{}
var GraphSrc string
var HashSrc string
var IRBuildSrc string
var IRDataSrc string
var IRDominanceSrc string
var IRDumpSrc string
var IRLowerGoSrc string
var IRLowerSrc string
var IROpsSrc string
var IRPassCSESrc string
var IRPassConstFoldSrc string
var IRPassDCESrc string
var IRPassInferArgTypesSrc string
var IRPassLICMSrc string
var IRPassMutabilitySrc string
var IRPassPipelineSrc string
var IRPassTraceSrc string
var IRPassTypeInferSrc string
var IRPassesSrc string
var IRValidateSrc string
force-rebuild-marker-2
var IRZipperSrc string
var IoSrc string
var PprintSrc string
var SetSrc string
var StringSrc string
var TestSrc string
var WalkSrc string
var ZipSrc string
Functions ¶
func AllNativeModules ¶ added in v1.10.0
func AllNativeModules() map[string][]*NativeModule
AllNativeModules returns a snapshot of the entire registry. Useful for tools that need the full view — the IR pipeline at codegen time, a REPL `(rt/native-modules)` inspector, parity diff scripts.
func ApplyGoOverrides ¶ added in v1.10.0
ApplyGoOverrides drains any pending overrides for ns and Defs them onto the namespace, replacing whatever bytecode or source replay produced. No-op if nothing is pending.
func ApplyVarMeta ¶ added in v1.11.0
ApplyVarMeta applies def metadata to v exactly as the bytecode defCompiler does: it sets the var's meta map, then mirrors the :dynamic / :private flags onto the Var. Shared by build-time def lowering (the apply-def-meta! builtin) and gogen-lowered `def` forms so both paths reproduce defCompiler's var setup (docstrings, type hints, ^:dynamic / ^:private). A nil/NIL meta is a no-op.
func BoxNativeFn ¶ added in v1.9.0
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
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 CachedVarFn ¶ added in v1.10.0
CachedVarFn lazily resolves a cross-namespace Var ONCE — memoizing it through the caller-supplied package-level pointer — then returns that var's CURRENT fn root for invocation. The lowered Go calls it as
rt.CachedVarFn(&__v_ns_name, "ns", "name").Invoke(args)
The *Var (not the fn) is what's cached, and its root is re-read on every call, so the var stays the override seam (^:dynamic / ^:redef / alter-var-root still work). Resolution is lazy (first call), not at package init(): blank-imported lowered packages run init() before the bundle replay loads namespaces, where LookupVar would return nil. The .(vm.Fn) assertion matches the trampoline's contract — every callable vm value implements vm.Fn.
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 DecodeResourceArchive ¶ added in v1.10.0
DecodeResourceArchive reverses EncodeResourceArchive.
func DefNSBare ¶ added in v1.3.0
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 DivValue ¶ added in v1.11.0
DivValue is the runtime target for the :div IR op when the operands aren't both native float64 (int/int yields a Ratio, mixed yields Float). Mirrors clojure.core// via vm.NumDiv so the lowered Go path matches the interpreter.
func DumpNamespaces ¶
func DumpNamespaces(fileName string)
func EDNEncodeArgs ¶ added in v1.1.0
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
EmbeddedSource returns the source of an embedded namespace by its dotted ns name.
Naming rule (the source-side analog of `cmd/lgbgen.nsToGoRelDir`, which nests the lowered Go tree the same way):
- 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 EmitVia ¶ added in v1.11.0
func EmitVia(ec *vm.ExecContext, name, dataJSON string)
EmitVia dispatches through the current *emit* binding. No-op when unbound (early boot, or a host that never installed an emitter).
func EncodeResourceArchive ¶ added in v1.10.0
EncodeResourceArchive serializes a name->bytes map into a gzip-compressed, self-describing archive. Entries are written in sorted name order so the output is deterministic for a given input.
func EqValue ¶ added in v1.11.0
EqValue implements Clojure value-equality (the = operator / OP_EQ) for the lowered Go path. Unlike Go's ==, it is safe on non-comparable dynamic types (vectors, maps, seqs) and compares by value, not interface identity. The lowerer routes = through here whenever an operand is vm.Value (it could hold a collection); concrete comparable scalars keep native Go ==.
func InternVar ¶ added in v1.11.0
InternVar interns (LookupOrAdd) a Var by namespace and symbol name, creating the namespace and/or the var if absent, and returns it. Used by gogen-lowered `def` forms, which must CREATE the var at runtime — unlike LookupVar, which only resolves an already-existing one (returning nil otherwise).
func InvokeValue ¶ added in v1.9.0
InvokeValue applies a runtime callable using let-go's dynamic invocation path.
func InvokeValueEC ¶ added in v1.11.0
InvokeValueEC is InvokeValue threaded with the caller's ExecContext, so a callable invoked from lowered code resolves dynamic vars (and propagates the scope to spawned goroutines) against the running context rather than the process root. A nil ec resolves to the root context. Values that are not vm.Fn (only the bare invoker interface) take the context-free path.
func JSONDecodeValue ¶ added in v1.1.0
JSONDecodeValue decodes a JSON string into a vm.Value.
func JSONEncodeArgs ¶ added in v1.1.0
JSONEncodeArgs encodes args as a plain JSON array string.
func LookupCoreVar ¶ added in v1.11.0
LookupCoreVar returns the *Var for a name in the core namespace, or nil if not installed. Exported for packages (e.g. nrepl) that need to PushBinding/PopBinding on the core I/O vars to implement scoped capture.
func LookupHostClass ¶ added in v1.10.0
LookupHostClass resolves a registered host-class name.
func LookupOrRegisterNS ¶
func MakeNativeMultiArity ¶ added in v1.9.0
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 MultiFnNativeFrozen ¶ added in v1.11.0
MultiFnNativeFrozen reports whether the multimethod var still holds its native baseline — the frozen *MultiFn captured at namespace-load completion. Generated native dispatch (the type-switch with baked _mm_* arms) calls this first and only takes the native arms when it returns true; otherwise it falls back to runtime dispatch through the var, which sees any late defmethod.
Resolution is lazy + memoized like CachedVarFn (the var pointer is filled on first call). A nil var, a non-MultiFn value, or an unfrozen MultiFn all return false — the safe default that routes through runtime dispatch.
func NormalizeResourceName ¶ added in v1.10.0
NormalizeResourceName canonicalizes a resource lookup name into a slash-separated path relative to a resource root. It strips a leading "/" or "./", collapses "." and in-root ".." segments, and reports ok=false for empty names or names that try to escape the root via "..".
func RegisterGoOverrides ¶ added in v1.10.0
RegisterGoOverrides queues a set of name → NativeFn bindings. If the target namespace already exists in the registry, the defs are applied immediately (the host has already finished bundle replay); otherwise they sit in pendingGoOverrides until ApplyGoOverrides drains them.
Init-order hazard this guards against: pkg/compiler's init() replays the core bundle and calls ApplyGoOverrides(coreNS) BEFORE the blank- imported lowered packages in main get to run their own init(). Without the immediate-apply path here, every override registered after that point would sit in the queue forever — the queue would be drained once when empty, then filled and never re-drained. Symptom is the dispatch counters reporting zero and `(reduce + (range 1000))` going through bytecode dispatch even with -tags gogen_ir + all the blank imports wired up.
func RegisterHostClass ¶ added in v1.10.0
RegisterHostClass maps a bare class name to a let-go value.
func RegisterHostMethod ¶ added in v1.10.0
RegisterHostMethod registers fn as the handler for `.name` on values whose type is t. The handler is invoked with the receiver as its first argument.
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 RegisterNativeModule ¶ added in v1.10.0
func RegisterNativeModule(m *NativeModule)
RegisterNativeModule self-registers a Go package as a contributor to a let-go namespace. Safe to call from init(); merges into the global registry without overwriting prior contributions to the same namespace.
If the same (ns, name) is registered twice, the latest wins — this matches the var rebinding semantics on the let-go side and lets a downstream package selectively override a builtin.
func RegisterNativeMultiFns ¶ added in v1.11.0
RegisterNativeMultiFns queues multimethod names whose native dispatch arms must be frozen for ns. If ns has already finished loading, the multifns are frozen immediately (the immediate-apply path RegisterGoOverrides also uses); otherwise they wait for ApplyGoOverrides.
func RequireNS ¶ added in v1.9.0
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 RunExitHooks ¶ added in v1.11.0
func RunExitHooks()
func SetEvalInNS ¶ added in v1.1.0
SetEvalInNS sets the namespace-aware eval function.
func SetNSLoader ¶
func SetNSLoader(loader NSLoader)
func SetReadEDN ¶ added in v1.1.0
SetReadEDN sets the EDN reader function (called by compiler package).
func SetResourceProvider ¶ added in v1.10.0
func SetResourceProvider(p ResourceProvider)
SetResourceProvider installs the provider consulted by io/resource.
func ShutdownAllPods ¶ added in v1.1.0
func ShutdownAllPods()
ShutdownAllPods gracefully shuts down all loaded pods.
func StorageIDFrom ¶ added in v1.11.0
StorageIDFrom derives the logical storage store id from already-resolved inputs and does no I/O of its own — the caller passes the working directory and executable path so the policy stays unit-testable. Precedence:
- an explicit flag id, when set;
- for a named script, its basename with the extension trimmed;
- for a named script whose basename says nothing about the app (".", "main", or "init"), the working-directory basename;
- the executable's basename. This is the bundle case: the script argument is empty, so cwd is not consulted and bundles key by exe name (stable regardless of the launch directory);
- "default".
cwd or exePath may be empty when the caller's lookup failed; an empty input is skipped rather than producing a "." or empty id.
func TransitDecodeValue ¶ added in v1.1.0
TransitDecodeValue decodes a transit+json payload string.
func TransitEncodeArgs ¶ added in v1.1.0
TransitEncodeArgs encodes a list of args for pod invocation.
func WithinRoot ¶ added in v1.10.0
WithinRoot reports whether the resolved path p is the resolved directory root or lies inside it. Both arguments must already be absolute and symlink-resolved (see resolveReal).
func WriteToErr ¶ added in v1.11.0
func WriteToErr(ec *vm.ExecContext, s string) error
WriteToErr writes s through the current dynamic binding of *err*. Falls back to os.Stderr.
func WriteToOut ¶ added in v1.11.0
func WriteToOut(ec *vm.ExecContext, s string) error
WriteToOut writes s through the current dynamic binding of *out*. Falls back to os.Stdout if *out* isn't installed yet or doesn't resolve to a handle (early-boot conditions only).
Types ¶
type EmbeddedResourceProvider ¶ added in v1.10.0
type EmbeddedResourceProvider struct {
// contains filtered or unexported fields
}
EmbeddedResourceProvider serves resources from an in-memory map decoded from the archive appended to a standalone binary.
func NewEmbeddedResourceProvider ¶ added in v1.10.0
func NewEmbeddedResourceProvider(files map[string][]byte) *EmbeddedResourceProvider
NewEmbeddedResourceProvider builds a provider over a decoded archive map.
func (*EmbeddedResourceProvider) Open ¶ added in v1.10.0
func (p *EmbeddedResourceProvider) Open(name string) (io.ReadCloser, bool)
Open implements ResourceProvider against the embedded map.
type Emitter ¶ added in v1.11.0
type Emitter interface {
Emit(name, dataJSON string)
}
Emitter is a sink for guest-dispatched host events.
type FSResourceProvider ¶ added in v1.10.0
type FSResourceProvider struct {
// contains filtered or unexported fields
}
FSResourceProvider resolves resources against an ordered list of filesystem roots; the first root containing the name wins.
func NewFSResourceProvider ¶ added in v1.10.0
func NewFSResourceProvider(roots []string) *FSResourceProvider
NewFSResourceProvider builds a provider over the given resource roots.
func (*FSResourceProvider) Open ¶ added in v1.10.0
func (p *FSResourceProvider) Open(name string) (io.ReadCloser, bool)
Open implements ResourceProvider. Errors and non-regular files (e.g. directories) are treated as "not found", so a lookup never panics on a permission race or a name that happens to be a directory.
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 FileStorage ¶ added in v1.11.0
type FileStorage struct {
// contains filtered or unexported fields
}
FileStorage persists keys as files below one host-selected root. Logical keys are encoded, never used as raw filenames, so callers can use portable string keys without learning filesystem path rules.
No in-process lock: native lg drives it from a single guest thread, and Set's atomic temp-then-rename keeps a concurrent reader from observing a torn value. Cross-process coordination is the host's responsibility.
func NewDefaultFileStorage ¶ added in v1.11.0
func NewDefaultFileStorage(storeID string) (*FileStorage, error)
func NewFileStorage ¶ added in v1.11.0
func NewFileStorage(root string) (*FileStorage, error)
func (*FileStorage) Get ¶ added in v1.11.0
func (s *FileStorage) Get(key string) (string, bool, error)
func (*FileStorage) Keys ¶ added in v1.11.0
func (s *FileStorage) Keys(prefix string) ([]string, error)
func (*FileStorage) Remove ¶ added in v1.11.0
func (s *FileStorage) Remove(key string) error
func (*FileStorage) Set ¶ added in v1.11.0
func (s *FileStorage) Set(key, value string) error
type FuncEmitter ¶ added in v1.11.0
type FuncEmitter func(name, dataJSON string)
FuncEmitter adapts a plain func into an Emitter, for api.WithEmit.
func (FuncEmitter) Emit ¶ added in v1.11.0
func (f FuncEmitter) Emit(name, dataJSON string)
Emit implements Emitter.
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 IOHandle ¶
type IOHandle struct {
// contains filtered or unexported fields
}
IOHandle is the runtime's I/O abstraction. It wraps an io.Writer and/or io.Reader so the same type backs file handles, stdin/stdout/stderr, bytes.Buffer-style captures, and embedder-supplied sinks. File-backed handles also retain the *os.File so callers that need Fd()/Sync() still have it.
func NewIOHandle ¶
NewIOHandle wraps an *os.File. Preserves all existing call sites and keeps file-specific operations (Fd, Sync) available via File().
func NewReaderHandle ¶ added in v1.11.0
NewReaderHandle wraps an arbitrary io.Reader. No writes.
func NewWriterHandle ¶ added in v1.11.0
NewWriterHandle wraps an arbitrary io.Writer. No reads.
func (*IOHandle) Close ¶
Close closes the underlying file if file-backed, or any wrapped writer/ reader that implements io.Closer. No-op for non-closable handles like bytes.Buffer or os.Stdout.
func (*IOHandle) File ¶
File returns the underlying *os.File or nil when the handle wraps an arbitrary writer/reader. Callers that need Fd()/Sync() (e.g. term/raw mode) must handle nil.
func (*IOHandle) Reader ¶
Reader returns a buffered reader over the underlying io.Reader, lazily constructed on first use. Returns nil for write-only handles.
func (*IOHandle) Sync ¶ added in v1.11.0
Sync flushes/syncs the handle. For file-backed handles, calls File.Sync. For writers that implement a Flush() error method (e.g. bufio.Writer), calls that. Otherwise no-op (buffers are eager).
type KeySource ¶ added in v1.11.0
type KeySource interface {
// ReadKey blocks until a key is available, returning the key's bytes as
// a string. Returns "" for end-of-input (the read-key nil contract).
ReadKey() (string, error)
// KeyPending reports whether a key is buffered and ready, without
// consuming it — the non-blocking peer of ReadKey.
KeyPending() bool
}
KeySource is a source of keypresses for term/read-key and key-pending?.
type LGReader ¶
type LGReader struct {
// contains filtered or unexported fields
}
LGReader wraps any io.Reader with optional buffering and close.
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.
type MemoryStorage ¶ added in v1.11.0
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage is the default inert-but-honest backend and the test/embedder convenience store. It is per-instance and does not persist.
func NewMemoryStorage ¶ added in v1.11.0
func NewMemoryStorage() *MemoryStorage
func (*MemoryStorage) Get ¶ added in v1.11.0
func (s *MemoryStorage) Get(key string) (string, bool, error)
func (*MemoryStorage) Keys ¶ added in v1.11.0
func (s *MemoryStorage) Keys(prefix string) ([]string, error)
func (*MemoryStorage) Remove ¶ added in v1.11.0
func (s *MemoryStorage) Remove(key string) error
func (*MemoryStorage) Set ¶ added in v1.11.0
func (s *MemoryStorage) Set(key, value string) error
type MouseEvent ¶ added in v1.11.0
type MouseEvent struct {
Action string // "press" | "release"
Button string // "left" | "middle" | "right" | "wheel-up" | "wheel-down" | "none"
X, Y int // 1-based cell coordinates
Shift, Ctrl, Meta bool
}
MouseEvent is a decoded SGR (1006) mouse report. Click-only scope: press and release of the three buttons plus wheel up/down, with Shift/Ctrl/Meta from the button byte. Drag/motion (the 1002/1003 modes) is out of scope, so the motion bit is ignored here — those modes are never enabled.
type Mult ¶
type Mult struct {
// contains filtered or unexported fields
}
Mult broadcasts values from a source channel to multiple tap channels.
type NSLoader ¶
func GetNSLoader ¶ added in v1.5.0
func GetNSLoader() NSLoader
type NativeDirectFn ¶ added in v1.10.0
type NativeDirectFn struct {
GoIdent string // exported Go identifier, e.g. "Seq"
Arity int // fixed arity; -1 for variadic
Variadic bool // true → final ParamSpec is the rest slice element type
ParamSpecs []string // Go type strings, e.g. []string{"vm.Value"}
ResultSpec string // Go type of single result, e.g. "vm.Value"
NeedsError bool // result tuple is (ResultSpec, error)
}
NativeDirectFn describes one direct-callable Go function. The shape matches the per-arity entry that *lowered-registry* holds for lowered Lisp defns, so the IR pipeline can treat both uniformly.
The current MVP scopes direct calls to vm.Value-only signatures with a (vm.Value, error) return. Variadic and typed-primitive params fall through to the existing rt.InvokeValue trampoline at the call site; they're representable here so future extensions can opt in.
func LookupNativeDirect ¶ added in v1.10.0
func LookupNativeDirect(ns, name string) *NativeDirectFn
LookupNativeDirect returns the descriptor for (ns, name) or nil if no module has registered it. The returned pointer is stable for the lifetime of the process.
type NativeModule ¶ added in v1.10.0
type NativeModule struct {
GoPkg string // import path, e.g. "github.com/nooga/let-go/pkg/rt/corefns"
Namespace string // target let-go namespace, e.g. "clojure.core"
Fns map[string]NativeDirectFn // let-go name → descriptor (e.g. "seq" → {GoIdent:"Seq", ...})
}
NativeModule is one Go package's contribution to one let-go namespace. A package can register N functions; each is direct-callable from lowered Go.
func LookupNativeModule ¶ added in v1.10.0
func LookupNativeModule(ns string) []*NativeModule
LookupNativeModule returns the modules contributing to ns. Useful for inspection / debugging / codegen tools that need to walk by package.
type Pod ¶ added in v1.1.0
type Pod struct {
// contains filtered or unexported fields
}
Pod represents a running babashka pod subprocess.
func (*Pod) InvokeAsync ¶ added in v1.1.0
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.
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 Resource ¶ added in v1.10.0
type Resource struct {
Name string
// contains filtered or unexported fields
}
Resource is the handle returned by io/resource. It is reader-coercible (the io namespace extends IReadable for it), so it flows through io/slurp, io/reader, and io/line-seq. It re-opens through its bound provider on each read, so a handle can be read more than once.
func NewResource ¶ added in v1.10.0
func NewResource(name string, p ResourceProvider) *Resource
NewResource builds a resource handle bound to a provider.
type ResourceProvider ¶ added in v1.10.0
type ResourceProvider interface {
// Open returns a reader over the named resource, or ok=false if absent.
Open(name string) (io.ReadCloser, bool)
}
ResourceProvider locates resource bytes by a normalized, slash-separated name. io/resource consults the currently-installed provider. There are two implementations: a filesystem provider (dev, backed by -resource-paths roots) and an embedded provider (a -b standalone binary, backed by the archive appended to the executable).
func GetResourceProvider ¶ added in v1.10.0
func GetResourceProvider() ResourceProvider
GetResourceProvider returns the currently-installed provider (may be nil).
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 Storage ¶ added in v1.11.0
type Storage interface {
Get(key string) (value string, ok bool, err error)
Set(key, value string) error
Remove(key string) error
Keys(prefix string) ([]string, error)
}
Storage is the host seam for persistent string key/value storage. Guest code names logical keys; the host owns the physical backend and namespace. Values are strings so callers keep serialization policy.
Error contract, uniform across backends and surfaced to guest code:
- Get of an absent key returns ok=false with a nil error, so storage/get yields nil. Get returns a non-nil error only when the backend itself fails (unreadable file, unavailable localStorage); that throws in the guest. Absence and failure are deliberately distinguishable.
- Set and Remove return an error on backend failure (full disk, quota, private-mode localStorage), which throws. They never silently drop a write — losing a save with no signal is the failure mode to avoid.
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.
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).
Source Files
¶
- async.go
- asyncembed.go
- check.go
- chunk_unbox.go
- core_embed.go
- core_embed_fs.go
- data.go
- disasm.go
- dump.go
- edn.go
- emitter.go
- exit_stub.go
- gogen.go
- gogen_override.go
- golower_runtime.go
- graph.go
- hash.go
- hierarchy.go
- http.go
- installers.go
- interop_xxh3.go
- io.go
- ions.go
- iort.go
- ir_bridge_generated.go
- irbuild.go
- irops.go
- irpasses.go
- js.go
- json.go
- key_tokenizer.go
- keysource.go
- lang.go
- math.go
- native_direct.go
- native_direct_install.go
- os.go
- parallel.go
- pods.go
- pprint.go
- print_method.go
- profile.go
- resources.go
- set.go
- storage.go
- storage_id.go
- string.go
- syscall_linux.go
- system.go
- term.go
- term_pty_linux.go
- test.go
- transit.go
- types.go
- types_linux.go
- unix_linux.go
- urlparam_default.go
- user.go
- walk.go
- zip.go
- zz_run_installers.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package builtins is the single-source home for direct-call-eligible clojure.core builtins: context-free functions with uniform vm.Value signatures.
|
Package builtins is the single-source home for direct-call-eligible clojure.core builtins: context-free functions with uniform vm.Value signatures. |
|
Package corefns is a placeholder while the lginterop-driven direct-call path is being wired up.
|
Package corefns is a placeholder while the lginterop-driven direct-call path is being wired up. |
|
Package wasm holds build-time JS and HTML assets for the `lg -w` WASM bundler.
|
Package wasm holds build-time JS and HTML assets for the `lg -w` WASM bundler. |