Skip to content

Prelude Boundary

Accepted

Accepted for module-system prelude behavior. The prelude is compiler-owned and not a module.

The canonical prelude surface and placement rule are documented in Prelude.

This page records only the module-system consequences.

The prelude is not a module and has no module.toml. It is a compiler-owned namespace authored with the compiler implementation, normally from prelude.ct and any compiler-owned helper files. The compiler may store or cache the prelude however it chooses, including source form, SIR form, or another implementation-private representation.

Every ordinary .ct file receives a compiler-provided initial scope containing the public prelude declarations and public prelude impls. This initial scope has the same conflict behavior as an import, but it is not literally import module("prelude") because prelude is not a module.

Every ordinary .ct file also has the qualified namespace name prelude bound to the compiler-owned prelude namespace:

prelude.Box(T)
prelude.Iterator(Item)

The prelude binding exposes only public declarations from the compiler-owned prelude namespace. Private/helper declarations in the prelude implementation are not visible through prelude.* or unqualified initial scope.

The initial prelude scope participates in normal import conflict rules. A user declaration or import that introduces the same unqualified name as a different prelude declaration is a hard conflict. Introducing the same declaration identity under the same name is idempotent. A user declaration named prelude conflicts with the compiler-provided prelude binding.

module("prelude") and module://prelude/... are invalid. Diagnostics should explain that prelude is compiler-provided and is not resolved through module(...).

The authored prelude implementation is built from the seeded prelude bootstrap environment documented in Comptime Bootstrapping and Compiler Objects, without implicit prelude injection. Helper files included by the prelude are part of defining the prelude and are also built without the ordinary prelude initial scope.

The authored V1 prelude should not depend on std. std is a normal toolchain-provided module that ordinary files can resolve explicitly; it is not part of the implicit prelude.

A future compiler mode may disable or replace the implicit prelude for specialized builds. That mode is not V1 source semantics.