Project notes

Decision 0003: Local modules and conservative formatting

Status: Implemented in 0.2.0-dev, October 12, 2026.

Problem

Programmers need to reuse deterministic policies across scripts, identify errors inside dependencies, and keep source files consistently indented. Copying helpers creates maintenance drift; executing dependencies during a syntax check creates surprising side effects.

Decision

Use explicit relative imports with an alias and explicit export let / export fn declarations. Resolve imports from the importing file, canonicalize file identity, reject cycles, and validate a bounded graph before execution. Evaluate each module once per run with its own environment. Share runtime resources and retain function source origins. Export reads resolve live bindings, while namespace writes remain unsupported.

Keep check as a non-executing frontend/dependency check. Dynamic names and types remain runtime concerns. No package manager or network fetching is introduced. See modules for limits and lifecycle semantics.

Ship a deliberately conservative formatter. Preserve syntax tokens, comments, literal content, inline layout, and internal newlines while normalizing indentation and exterior whitespace. Validate before formatting, verify token equivalence, and test idempotence and runtime behavior. Default to stdout; make rewrites and CI checking explicit options.

Consequences

  • Shared policies become small, testable files; error locations point to the defining dependency, including returned closures.
  • Explicit file imports are portable across operating systems but do not provide dependency distribution or version pinning.
  • Module initialization may have side effects; reusable libraries should keep top-level code declarative.
  • Exports reserve three new keywords, requiring identifier migrations where necessary.
  • Mutable exported collections remain shared. Modules provide organization and namespace privacy, not isolation from untrusted code.
  • A full formatter requires source trivia/round-trip infrastructure before safely changing line layout or operator spacing.
  • Native CI and user trials remain acceptance gates beyond local engineering checks.
Found something to improve?Edit this page on GitHub ↗
Search guides, language features, and APIs ↵ to open first result