prep.3 — Kernel-tier modules (kernel: true) + param-in restriction #33
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Third iteration of the
kernel-extension-mechanicsarc, terminal step. Depends on prep.1 (type-scoped lookup feeds into kernel-tier resolution) and prep.2 (Term::New uses param-in for arg-type checking).Goal. Generalise the existing single-name hardcoded prelude auto-injection (loader.rs:98-108 + workspace.rs:308-311, 467, 2655) into a flag-driven multi-module mechanism. Add a closed-set type-parameter restriction for TypeDefs.
Scope (from spec § Iteration prep.3):
ailang-core/src/ast.rs:Module.kernel: bool(skip_serializing_if=is_false),TypeDef.param_in: BTreeMap<String, BTreeSet<TypeName>>(skip when empty).(kernel)module-header attribute,(param-in (var t1 t2 ...))TypeDef attribute.kernel: truemodules. Prelude gainskernel: trueas code-path migration (observable behaviour unchanged —prelude_free_fns.rsregression test stays green).param-inonType::Conresolution.ParamNotInRestrictedSet.WorkspaceLoadError::ReservedModuleNamerepurposed (any built-in kernel module name reserved, not specificallyprelude).crates/ailang-kernel-stub/crate as the minimal ratifying fixture (one parametric TypeDef withparam-in, one trivialnew). Stub exercises the mechanism without domain content.module_kernel_flag_round_trips,typedef_param_in_round_trips, basic stub-module round-trip.(import ...)declaration; explicit-import-overrides-auto-import precedence.Spec: docs/specs/2026-05-28-kernel-extension-mechanics.md § Iteration prep.3.
Whitepaper: design/models/kernel-extensions.md § 3. Kernel-tier modules + § 4. param-in restriction.