Expand description
Declarative stdlib builtin catalogue (#778).
One BuiltinDef per builtin is the single source for everything
the toolchain knows about it: the type-checker’s module scope
(module_record), the runtime’s purity answer and dispatch table
(lex-runtime keys its implementations by the same (module, name)
and a test there asserts the two sets agree), and the generated
stdlib reference in docs/AGENT.md (lex docs --stdlib-spec).
Signatures are written in Lex type syntax and parsed by the real
parser, so the catalogue cannot drift from what lex check accepts.
Type variables are single lowercase letters (a, b); an open
effect row is written [| E] exactly as in user code, and the same
E on a closure parameter and on the result ties the two rows
together (list.map’s closure effects flow to the call).
Modules migrate here one at a time; builtins::module_scope still
holds the hand-written signatures for the rest. Adding a builtin to a
migrated module means one entry here plus one implementation in the
runtime table, and nothing else.
Structs§
Enums§
- Builtin
Kind - How a builtin is executed.
- Index
Convention - Which index convention a builtin’s integer positions use. Recorded so the stdlib reference states it and a runtime test checks it; it is documentation, not a semantic switch (#778).
Constants§
- BUILTINS
- Every declared builtin, in the order the stdlib reference lists them (module order, then declaration order within a module).
Functions§
- declared_
modules - Modules whose signatures come from this catalogue rather than from
the hand-written tables in
builtins::module_scope. - defs_
for - The definitions of one module, in declaration order.
- is_
declared_ module - lookup
- module_
record - The value-level scope of a declared module: a record of its builtins
in declaration order, exactly what
builtins::module_scopereturns for the hand-written modules. Parsed once per process. - parse_
signature - Parse one signature into a
Ty.eff_varis the row-variable id to use for the definition’s open row, if it has one.