docs(metatype): generic type-fn body locals done; only List growth remains
This commit is contained in:
@@ -114,17 +114,15 @@ shifts every `.ir` snapshot. On-demand import keeps the prelude clean.
|
|||||||
## Next step
|
## Next step
|
||||||
The reflect/construct triad is COMPLETE — `` `enum `` (`0619`), `` `struct ``
|
The reflect/construct triad is COMPLETE — `` `enum `` (`0619`), `` `struct ``
|
||||||
(`0622`), `` `tuple `` (`0623`) all reflect AND construct + round-trip. Remaining
|
(`0622`), `` `tuple `` (`0623`) all reflect AND construct + round-trip. Remaining
|
||||||
METATYPE work is the deferred enhancements (see below), all clean diagnostics
|
METATYPE work is ONE deferred enhancement, a clean diagnostic rather than a crash:
|
||||||
rather than crashes:
|
|
||||||
- **Comptime `List` growth** — `List(EnumVariant).append` at comptime bails
|
- **Comptime `List` growth** — `List(EnumVariant).append` at comptime bails
|
||||||
("struct_get: base has no fields"); the allocator/List protocol path isn't fully
|
("struct_get: base has no fields"); the allocator/List protocol path isn't fully
|
||||||
interp-evaluable. Probe `.sx-tmp/probe_makeenum.sx`.
|
interp-evaluable (heap alloc + protocol dispatch + List internals at comptime —
|
||||||
- **Generic type-fn body locals** — a generic `($T) -> Type` comptime-evals only
|
a deeper, multi-step interp effort). Probe `.sx-tmp/probe_makeenum.sx`. Doesn't
|
||||||
its return EXPRESSION (`generic.zig:1760`); a local before the return is
|
block anything: array-literal locals already work for building variant lists
|
||||||
unresolved. Workaround: non-generic builder (`examples/0620`). Probe
|
(`examples/0620`/`0624`).
|
||||||
`.sx-tmp/probe_me5.sx`.
|
The metatype surface (declare/define/type_info/field_type + make_enum) is
|
||||||
Neither blocks anything; the metatype surface (declare/define/type_info/field_type
|
feature-complete for the locked design; generic type-fn body locals now work too.
|
||||||
+ make_enum) is feature-complete for the locked design.
|
|
||||||
- ~~**Validation + loud diagnostics**~~ — COMPLETE. duplicate variant names
|
- ~~**Validation + loud diagnostics**~~ — COMPLETE. duplicate variant names
|
||||||
(`examples/1180`); `declare()` never `define()`d (`examples/1181`, was a
|
(`examples/1180`); `declare()` never `define()`d (`examples/1181`, was a
|
||||||
`verifySizes` panic); by-value self-reference for both source (`1178`) and
|
`verifySizes` panic); by-value self-reference for both source (`1178`) and
|
||||||
@@ -149,11 +147,10 @@ capabilities would let the variant list be built more freely; both error cleanly
|
|||||||
- **Comptime `List` growth.** Building variants via `List(EnumVariant).append` at
|
- **Comptime `List` growth.** Building variants via `List(EnumVariant).append` at
|
||||||
comptime bails ("struct_get: base has no fields") — the allocator/List protocol
|
comptime bails ("struct_get: base has no fields") — the allocator/List protocol
|
||||||
path isn't fully interp-evaluable. Probe `.sx-tmp/probe_makeenum.sx`.
|
path isn't fully interp-evaluable. Probe `.sx-tmp/probe_makeenum.sx`.
|
||||||
- **Generic type-fn body locals.** A *generic* `($T) -> Type` comptime-evals only
|
- ~~Generic type-fn body locals~~ — DONE. A generic `($T) -> Type` now
|
||||||
its return EXPRESSION (`generic.zig:1760`, `findReturnTypeExpr`), so a local
|
comptime-evaluates its FULL body (prelude statements + return), so a local
|
||||||
before the return is unresolved. Workaround: build the list inline in the return,
|
before the return resolves. `createComptimeFunctionWithPrelude` +
|
||||||
or use a non-generic `() -> Type` builder (whose whole body is evaluated — this
|
`evalComptimeTypeBody`; no-prelude bodies stay on the old path. `examples/0624`.
|
||||||
is what `examples/0620` uses). Probe `.sx-tmp/probe_me5.sx`.
|
|
||||||
|
|
||||||
## Known issues
|
## Known issues
|
||||||
- issue 0140 — comptime type-construction bail panicked instead of diagnosing —
|
- issue 0140 — comptime type-construction bail panicked instead of diagnosing —
|
||||||
@@ -167,6 +164,12 @@ capabilities would let the variant list be built more freely; both error cleanly
|
|||||||
`examples/1178` locks it).
|
`examples/1178` locks it).
|
||||||
|
|
||||||
## Log
|
## Log
|
||||||
|
- **Generic type-fn body locals.** A generic `($T) -> Type` comptime-evaluated
|
||||||
|
only its return EXPRESSION, so a local before the return was unresolved. Now a
|
||||||
|
body with a prelude (statements before the return) has its FULL body evaluated:
|
||||||
|
`createComptimeFunctionWithPrelude` lowers the pre-return statements into the
|
||||||
|
comptime function's scope, then the return expr. No-prelude bodies (RecvResult
|
||||||
|
etc.) stay on the old path → zero regression. `examples/0624`. Suite green (685).
|
||||||
- **Tuple widening done — reflect/construct triad complete.** `TypeInfo` gained
|
- **Tuple widening done — reflect/construct triad complete.** `TypeInfo` gained
|
||||||
`` `tuple(TupleInfo) `` (positional `[]Type`); `reflectTypeInfo` reflects a
|
`` `tuple(TupleInfo) `` (positional `[]Type`); `reflectTypeInfo` reflects a
|
||||||
`.tuple` (bare type_tags, tag 2), `defineType` dispatches tag 2 → `defineTuple`
|
`.tuple` (bare type_tags, tag 2), `defineType` dispatches tag 2 → `defineTuple`
|
||||||
|
|||||||
Reference in New Issue
Block a user