Skip to content

Imports

Builtins are implicit, standard dictionaries are imported explicitly, and project files use .l includes. Neighboring files cannot silently replace a standard dictionary.

The basic program imports IO's Print from io under the local name Print. The standard-library index maps eng/io to the IO dictionary, whose public member is IO.Print; rendering and writing helpers remain private. Builtins need no project copy, but Print requires its import. A local io or io.l does not shadow the indexed io import.

demo/dictionaries/file-import/main.l
Use LocalTools's Greeting from `helpers.l` as "Greeting".
Use LocalTools's Display as "Display".
Display Greeting.

Complete program. Source: demo/dictionaries/file-import/main.l.

Example evidence

Project-owned member imports resolved relative to the importing file. existing-witness-not-run. Evidence guide.

The companion file supplies the declarations:

demo/dictionaries/file-import/helpers.l
Create "LocalTools" as a Dictionary.
Define LocalTools's "Greeting" as `local hello|`.
Create LocalTools's "Display|-s|-ed|-ing|-er" for Showing any Text.

Fragment. Source: demo/dictionaries/file-import/helpers.l.

Example evidence

Companion vocabulary source for file-import; displayed as a source unit, not independently run. existing-witness-not-run. Evidence guide.

The first sentence loads the declarations in helpers.l, including LocalTools and its members, then gives Greeting a local alias. Display is now known, so the second sentence only creates its short alias; it needs no file clause. Display Greeting calls the Show action and produces local hello| without a newline.

Keep both files together. helpers.l resolves beside the importing source, regardless of the CLI's working directory or executable location. The distribution CLI tests cover this behavior and the exact output.

Project files expand at their import positions. Builtins and indexed dictionaries retain separate scopes; dictionaries inherit builtins, not arbitrary caller locals. An alias preserves its member's canonical owner and identity without exposing private helpers.

Lookup checks a complete qualified binding before traversing members of its selected owner. A missing member does not trigger a search through unrelated names or filesystem paths. Import cycles reject; missing files and members produce distinct errors attributed to the original source.

Released compilers embed the English resources used above. Compiler developers can override the resource bundle. Next, organize Apps and Services.


Canonical source: docs/guide/imports.md.