Skip to content

Prelude Compiler Boundary

Accepted

Accepted for the V1 compiler/prelude boundary; the exact prelude surface is tracked in Scope Backlog.

The compiler may assume the prelude exists when compiling ordinary Catalyst code, but it should not bake broad library behavior into sema. Sema recognizes language constructs and checks the contracts they lower to. The declarations and implementations for those contracts should remain visible to reflection and tooling.

Examples:

  • a == b lowers through PartialEq(RightType)
  • a < b lowers through PartialOrd(RightType)
  • a + b lowers through Add(RightType, ResultType)
  • -a lowers through Neg(ResultType)
  • for item in xs resolves Iterable(Item) or Iterator(Item)
  • items[i] resolves Indexable(T)
  • Box(dyn Iterator(Item)) works through normal prelude implementations plus compiler-provided dyn metadata

If a feature can be expressed as ordinary library code without affecting syntax, type checking, or core ownership semantics, it should start in std, not the prelude.