Skip to main content

Crate harn_builtin_registry

Crate harn_builtin_registry 

Source
Expand description

Process-global registry of builtin signatures.

harn-vm owns the implementations and emits one &'static BuiltinDef<H> per #[harn_builtin]-annotated function via the harn-builtin-macros crate. At startup the driver (CLI, LSP, lint, serve, dap, tests) installs the full slice of signatures here; the parser/typechecker then reads them through installed_signatures.

This decouples harn-parser (which needs to see signatures to typecheck) from harn-vm (which owns the impls) without a dependency cycle — harn-parser depends only on this crate plus harn-builtin-meta, never on the vm.

Structs§

BuiltinDef
A complete description of one builtin: its signature, its aliases, the runtime handler (typed by the consumer via H), and optional metadata.

Functions§

install_builtin_signatures
Install the process-global signature registry. Called once by the driver (CLI, LSP, lint, serve, dap) at startup. Test harnesses that build a Vm via harn_vm::stdlib::stdlib_probe_vm() inherit the install through that helper.
installed_signatures
Read the installed signature slice. Returns an empty slice before the first call to install_builtin_signatures (e.g. in pure-parser unit tests that don’t need a registry).
is_installed
True when the registry has been populated. Useful for guards in parser code that wants to assert it’s running in a configured driver context.