Skip to content

Modules And Imports

Chris Michael edited this page Sep 2, 2026 · 2 revisions

Pudu

Modules And Imports

module App.Report

import Std.Json as Json
import Std.Option {map, unwrapOr}

Status: module discovery, imports, privacy, selected imports, cycles through declaration signatures, and interpreter linking are implemented. A project manifest and package manager are not.

Module identity

The declaration at the top of a file names the module. A module name and source path must agree when the compiler discovers a program graph. Imported declarations preserve nominal identity: two types with the same spelling from different modules are different types.

Import forms

import Std.Text
import Std.Text as Text
import Std.Text {trim, split}

Imports are explicit and do not re-export automatically. Resolution is deterministic and does not depend on import order. Ambiguous unqualified names are diagnostics.

The Core.Prelude import is implicit unless the module imports that same module explicitly. Standard-library modules use the Std namespace and ship with the compiler.

Visibility

Top-level declarations are private unless marked export. A module can use its private helpers; importers cannot. Type and value namespaces are distinct.

Program graph

pudu check, pudu run, the REPL loader, documentation commands, and the LSP use the same program compiler. Imports are loaded transitively from source roots. Missing files and module/path mismatches are structured diagnostics.

Current boundary

There is no manifest, lockfile, registry, dependency solver, or package build graph. Each CLI file argument is currently a root program.

Related

Clone this wiki locally