Skip to content

Write native-backed definitions

Build words from existing words, with logemes supplying small target-specific foundations. Native leaves must obey the target's type, ownership and lifetime contracts.

The core defines Function through a logeme composition. Objective builds on Function; Main and Basic compose the entry structure. Function bodies use Process and the selected Return member. These words are already available without import.

IO.Print follows the same pattern: it composes typed Render functions with Write. Extend vocabulary through reusable nouns, verbs and descriptors before introducing a native leaf.

The retained ProbeIO fixture illustrates a small native leaf exposed through a dictionary:

cmd/l/test/runnable_service/probe.l (lines 1–3)
Define "Log|-s|-ged|-ging|-ger" to `<DEF>BOD^E{|Statement: ~std::io::Write::write_all(&mut std::io::stdout(), (<@Output|Thing@>).as_bytes()).unwrap();~|}<DEF>`.
Create "ProbeIO" as a Dictionary.
Create ProbeIO's "Print|-s|-ed|-ing|-er" for Processing a New Logger.

Fragment. Source: cmd/l/test/runnable_service/probe.l (lines 1–3).

Example evidence

Native-backed ProbeIO dictionary operation used by App bodies; this vocabulary fragment is not independently executable. existing-witness-not-run. Evidence guide.

Log declares its inflections; Logger is its constructed form. <DEF>…<DEF> frames the logeme body. BOD^E supplies a bounded native statement, not an alternative place to implement composed language behavior.

Its caller imports the dictionary member and supplies App-body work:

cmd/l/test/runnable_service/basic.l (lines 1–4)
Use ProbeIO's Print from `probe.l` as "Print".
Create "Worker" as a New Basic App.
The App Prints `work completed
`.

Fragment. Source: cmd/l/test/runnable_service/basic.l (lines 1–4).

Example evidence

ProbeIO caller import and App-body use; requires sibling probe.l and omits the later Build/Run/Await/Show instructions. The Text includes an explicit newline. existing-witness-not-run. Evidence guide.

This excerpt requires sibling probe.l; the complete caller ends with Build, Run, Await and Show. The probe writes exact Text bytes; public IO.Print adds a newline.

<@Output|Thing@> declares a typed argument; this leaf's .as_bytes() call requires Text. <@Process@> instead binds an instantiated definition. See typed slots for the supported kinds.

Text receives protected Rust quoting; Number uses finite binary64 encoding. Preserve literal bytes and use definition composition for executable behavior.

The declaration/evaluation witness shows the AML backend interface. Alphabet and composition explains its glyphs and grouping. Generation returns a source bundle; native compilation and execution are separate steps.

The eighteen Rust segments are frozen. Lifetime/generic inputs are glyph-local native interiors, not L generics, Func/Prop/Op fields or inherited defaults. Rust rejects Deferred metadata; scheduling supplies no automatic deferred cleanup.

Compose within the existing definition, builtin, Rust and AML contracts.