docs(reify): Phase 4 self-reference = explicit reserve()/complete()
User-directed API decision: replace the reify_rec((self)=>...) closure with an explicit reserve() -> Type handle + complete(handle, info) pair. reserve() returns a forward nominal Type usable freely in any later TypeInfo (*List, []List, and across types for mutual recursion the one-self closure couldn't express); reify(info) stays as the one-shot sugar. Maps onto existing reserve->complete machinery. Captured in PLAN-REIFY Phase 4 + Contract 5 + CHECKPOINT-REIFY.
This commit is contained in:
@@ -61,12 +61,16 @@ 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`).
|
||||
|
||||
OPEN DESIGN Q (raised by user, = Phase 4): self-referencing enum via `*Self`/`[]Self`
|
||||
payloads. Current `reifyType` resolves each payload eagerly through `buildEnumInfo`,
|
||||
so a `*Self` payload has no type to point at yet — Phase 4 needs the
|
||||
reserve-placeholder→complete path (`nominal.zig` reserve + `types.zig:442`): intern
|
||||
the enum's nominal slot FIRST, expose it as `Self`, then resolve payloads. By-value
|
||||
recursion stays rejected (infinite size).
|
||||
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.
|
||||
|
||||
## Known issues
|
||||
None yet.
|
||||
|
||||
Reference in New Issue
Block a user