Skip to main content

Module builtins

Module builtins 

Source
Expand description

The builtin / control-construct vocabulary: the single source of truth for which names the language knows, their arities, and a one-line doc each. Reconciled in docs/design/BUILTIN_VOCAB.md.

This is data only — no symbol mapping (that stays compiler-side in codegen/lower.rs::DET_BUILTINS) and no dispatch (the runtime keeps its own match). Codegen and the runtime are checked against this table; the LSP (completion + hover) reads it directly.

Zero-dependency, like the rest of plg-shared. IMPORTANT: the runtime must NOT reference BUILTINS outside #[cfg(test)] — the doc strings would otherwise land in every compiled program binary (see the doc’s “doc strings must never reach a compiled program” constraint).

Structs§

BuiltinSpec
One vocabulary entry. arity is the canonical arity; call/N is listed once at its minimum arity (1) and noted variadic in doc.

Enums§

BuiltinKind
Where a name is handled, used only to partition the validation that codegen/runtime stay in sync with this table. Not a dispatch hint.

Constants§

BUILTINS
The full vocabulary (55 rows). Docs for everything except , ; -> port verbatim from v1’s BUILTIN_DOCS; those three are new. rustfmt::skip keeps it as a one-row-per-line table — the doc strings would otherwise wrap to five lines each.

Functions§

atom_names
Completion: arity-0 names worth offering.
doc
First doc for name regardless of arity — hover is arity-insensitive (the cursor is on a name, not a resolved call).
functor_names
Completion: (name, arity) for arity->0 names worth offering.
lookup
Exact lookup by name and arity (call/N matches only at arity 1).