The prelude gives you a few names without an import. It keeps common output convenient without making every Core package global.
What you get without importing
The io namespace comes available in normal source files. It exposes Core IO helpers such as io.line(...).
io.line("Hello from the prelude")
The compiler-owned Error type also stays available for Error! flows.
What still needs an import
Most Core packages require explicit imports:
import @core/math {sin}
import @core/time {mark_now}
For the full prelude contract, collision rules and builder ownership, see Prelude policy advanced.
The prelude forms visibility policy, not an @core/prelude package. It defines the small set of names available without an explicit import. No @core/prelude package exists to import.
Registered prelude surface
The prelude registers one namespace alias:
| Bare name | Alias target | Exposes | |---|---|---| | io | @core/io | Core IO console and input helpers |
The bare io namespace behaves as a compile-time alias to @core/io. It does not act as a runtime value. An explicit import @core/io binds the same io namespace. An explicit import @core/io as output creates a separate file-local namespace name. A different alias name does not shadow the prelude alias. Only a same-name collision follows the ordinary no-shadowing model.
Compiler-owned bare symbols
The compiler-owned Error type stays available as a bare language symbol for Error! flows. It works as a compiler-owned builtin, not a prelude symbol. The prelude registry does not register it. See Errors, options and assertions for the Error contract.
Collision policy
Prelude names participate in the ordinary no-shadowing collision model. Same-file declarations, source imports, binding imports, aliases, prelude symbols and builtins cannot silently shadow one another. The prelude registers io as a reserved name first, then inserts it only if not shadowed.
What the prelude does not include
Most Core packages require explicit imports:
import @core/math {sin}
import @core/time {mark_now}
import @core/text {length}
import @core/random {random_int}
The prelude does not expose @core/collections directly. Collection methods work as compiler-owned receiver methods that lower to @core/collections host functions. See Core collections for that relationship.
Builder ownership
The builder provides the prelude. The HTML builder registers the io namespace alias through the Core prelude registration. The prelude surface forms the minimal universal starting point. Builders must provide it, but the actual implementations live in specific Core packages such as @core/io.
Unsupported source forms
import @core/prelude lacks validity. No @core/prelude package exists.- The prelude does not expose a namespace record that can be passed as a runtime value.
- The prelude does not expose
@core/math, @core/text, @core/random, @core/time or @core/collections without explicit imports.
Related concepts