Skip to main content

Module builtins

Module builtins 

Source
Expand description

Built-in functions over already-evaluated values.

show is NOT here — output is an engine concern. Arity is checked by the caller BEFORE evaluating arguments (via check_arity) to preserve the tree-walker’s error ordering: a wrong-arity call reports the arity error even when an argument expression would itself error.

Enums§

BuiltinEffect
What calling a builtin can do beyond computing its result — the fact the effect analysis (optimize::effects) needs to reason about a call it cannot look inside.
BuiltinId

Constants§

BEGIN_PAINT_RETIRED
What a call to beginPaint is refused with, on every tier.
MOVE_CHILDREN_RETIRED
What a call to moveChildren is refused with, on every tier.
RETIRED_BUILTINS
Every builtin the language no longer has: its id, which keeps its wire position, the spelling a program called it by, and the sentence that call is refused in.

Functions§

builtin_from_name
Resolve a function name to a builtin, if it is one.
call_builtin
check_arity
Check the call’s arity BEFORE evaluating arguments. format accepts any arity (it reads only its first argument, or none).
contract_reason_text
The text a broken contract reports: its , otherwise reason, which must be Text. Shared by the tree-walker and the VM so both refuse a non-Text reason with the same words.
inspect_unhandled_message
The loud message for a non-exhaustive Inspect: no When arm matched the scrutinee’s ACTUAL variant and there was no Otherwise — gauntlet finding G5. Shared by the tree-walker and the VM so a mistyped arm (When Err (message): against a JsonResult, whose real variant is JErr) fails with the identical words wherever it runs, naming the value it actually got rather than the value-agnostic “the value” this message used to say before either tier could reach the runtime value that trapped it (current_site/Stmt::Site already gives both tiers the sentence’s own location on top of this, through the ordinary runtime-failure path — this message is only the “what”, not the “where”).
random_int
randomInt(lo, hi) — a uniform draw from lo..=hi through the one system seam (a sealed test world decides it), or the refusal of a range whose low bound is above its high bound, which every host words alike.
retired_builtin
The sentence a call to a builtin the language no longer has is refused in, before the program runs; None for every other name. A program that defines a function of the same name calls its own.
rust_only_native
The natives the Rust backends link from logicaffeine_system and no other engine runs, as (module, function): the FIPS-202 hashes, which a program declares native to take the Rust implementation in place of crypto.lg’s pure-LOGOS sponge. The Rust backends’ table reads this, and every other engine refuses a call to one by the Rust function it names.
system_native
The standard library’s system natives that run through call_builtin — file.lg’s read and write, random.lg’s randomInt and randomFloat, env.lg’s get, time.lg’s now — by name and arity. The one table the tree-walker and the VM compiler both consult, so a native cannot be wired on one tier and fall through to its empty body on the other. A caller asks it only for a ## To native declaration: a program’s own function of the same name always wins.
unimplemented_native
What a call to a ## To native declaration no engine implements is refused with, on every tier. A declaration naming a Rust path (is native "crate::module::function"), or a native only the Rust backends link (rust_only_native), runs only where Rust links it, as Escape to Rust: does; one naming no path and no system native is the Rust backends’ own compile-time refusal, in their words.
vfs_read_failure
Read a Seq of Int as raw bytes (each element masked to 0–255) — the byte-array convention the UUID/hash builtins share with uuid.lg so the version constructors can be written in LOGOS. Why a file statement’s read of the sandboxed file system fails, as every tier reports it.
vfs_write_failure
Why a file statement’s write to the sandboxed file system fails, as every tier reports it.