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§
- Builtin
Spec - One vocabulary entry.
arityis the canonical arity;call/Nis listed once at its minimum arity (1) and noted variadic indoc.
Enums§
- Builtin
Kind - 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’sBUILTIN_DOCS; those three are new.rustfmt::skipkeeps 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
nameregardless 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/Nmatches only at arity 1).