docs(reify): name Phase 4 self-reference pair declare()/define()

User picked the declaration-vs-definition split over reserve/complete.
declare() returns a forward nominal Type handle (named from the :: LHS);
define(handle, info) fills its body. reify(info) stays the one-shot
sugar. Updated PLAN-REIFY Phase 4 + Contract 5 + CHECKPOINT-REIFY.
This commit is contained in:
agra
2026-06-16 18:45:08 +03:00
parent ae5de1e687
commit 04e833a825
2 changed files with 27 additions and 25 deletions

View File

@@ -61,16 +61,17 @@ only at the `E :: reify(...)` const-decl site (`decl.zig`) and reads a LITERAL
(and likely generalize the literal-AST reader, or evaluate via the interpreter, for
non-literal `TypeInfo`).
SELF-REFERENCE = Phase 4, API DECIDED (user-directed): explicit **`reserve()` →
`complete()`** (NOT a `reify_rec((self)=>…)` closure). `reserve()` returns a forward
nominal `Type` handle (named from the `::` LHS) usable freely in any later `TypeInfo`
— `*List`, `[]List`, and across types for MUTUAL recursion the one-`self` closure
couldn't express; `complete(handle, info)` fills the body. `reify(info)` stays as the
one-shot sugar. Maps onto existing machinery: reserve = empty nominal slot
(`reserveShadowEnumSlot`-style), complete = `buildEnumInfo` + `updatePreservingKey`,
struct-stub→tagged_union re-key already handled (`internNamedTypeDecl`'s
`adoptsForwardStructStub`). Loud invariants: never-completed reserve = hard error;
by-value self-inclusion rejected (infinite size). Full write-up in PLAN-REIFY Phase 4.
SELF-REFERENCE = Phase 4, API DECIDED (user-directed): explicit **`declare()` →
`define(h, info)`** (the declaration-vs-definition split; NOT a `reify_rec((self)=>…)`
closure). `declare()` returns a forward nominal `Type` handle (named from the `::`
LHS) usable freely in any later `TypeInfo` — `*List`, `[]List`, and across types for
MUTUAL recursion the one-`self` closure couldn't express; `define(handle, info)` fills
the body. `reify(info)` stays as the one-shot sugar. Maps onto existing machinery:
declare = empty nominal slot (`reserveShadowEnumSlot`-style), define = `buildEnumInfo`
+ `updatePreservingKey`, struct-stub→tagged_union re-key already handled
(`internNamedTypeDecl`'s `adoptsForwardStructStub`). Loud invariants: never-defined
declare = hard error; by-value self-inclusion rejected (infinite size). Full write-up
in PLAN-REIFY Phase 4.
## Known issues
None yet.