comptime-API: strip the byte-weld; pivot to a flat-memory comptime VM
The byte-weld (sx structs whose layout was validated to mirror the compiler's Zig records) plus the serialization/marshaling bridge was the wrong direction: it bolted a parallel layout regime and hand-built byte-copies onto a comptime value model that fundamentally isn't bytes. Strip the struct-weld machinery: - compiler_lib.zig loses the type registry (weldStruct / bound_types / BoundType / FieldLayout / findType / SxField / LayoutMismatch / validateStructLayout); it is now just the intern/text_of function host-call bridge (kept as the Phase-3 compiler-call seed). - nominal.zig loses validateWeldedStruct / weldedFieldOrderStr + the sd.abi == .zig validation call. - Remove the struct-weld unit tests and examples 0625/0627 (welded structs) + 1183/1186 (weld-layout diagnostics). - The #library / abi / extern syntax stays. Record the new direction: a bytecode VM over flat, byte-addressable memory so comptime values are native bytes (no weld/validation/marshal), target-aware (preserves cross-compilation) and sandboxed. See current/PLAN-COMPILER-VM.md (Phase 0 strip -> Phase 1 flat-memory value model -> Phase 2 bytecode -> Phase 3 compiler-API on flat memory). design/comptime-compiler-api.md gets a SUPERSEDED banner. Also drop the "~500 lines / split the step" rule from CLAUDE.md.
This commit is contained in:
@@ -1,10 +1,23 @@
|
||||
# Comptime Compiler API — `#library "compiler"` + `abi(.zig) extern`
|
||||
|
||||
> **Status: design-of-record (not yet an active stream).** Captures a unified
|
||||
> mechanism for sx↔compiler binding that subsumes the metatype `declare`/`define`
|
||||
> primitives AND the `#compiler` struct attribute, and exposes the compiler's own
|
||||
> type-table API to comptime sx. Supersedes the bespoke `meta.sx` `TypeInfo`
|
||||
> projection (the "weld it" decision). Design locked 2026-06-17.
|
||||
> **⚠ SUPERSEDED (2026-06-17) — direction changed. See
|
||||
> [`../current/PLAN-COMPILER-VM.md`](../current/PLAN-COMPILER-VM.md).**
|
||||
> The **byte-weld** approach below (sx structs whose layout is validated to mirror
|
||||
> the compiler's Zig types, plus serialization / marshaling at the call boundary) is
|
||||
> the **wrong direction** and is being stripped. The comptime value model
|
||||
> fundamentally isn't bytes, so the weld bolts a parallel layout regime + hand-built
|
||||
> byte-copies onto it. The new foundation: a **bytecode VM over flat, byte-addressable
|
||||
> memory**, where comptime values ARE native bytes — so the compiler-API needs no
|
||||
> weld, no validation, no marshaling (the compiler exposes its real types/functions
|
||||
> and sx reads/builds them directly as memory). The goal below (unify
|
||||
> `declare`/`define`/`type_info` + `#compiler` onto one mechanism, delete the bespoke
|
||||
> arms) is unchanged; only the *mechanism* is. This doc is retained for history and to
|
||||
> scope the Phase 0 strip — do NOT implement the weld machinery from here.
|
||||
>
|
||||
> **Original status:** design-of-record. Captured a unified mechanism for
|
||||
> sx↔compiler binding that subsumes the metatype `declare`/`define` primitives AND the
|
||||
> `#compiler` struct attribute, and exposes the compiler's own type-table API to
|
||||
> comptime sx. Design locked 2026-06-17; weld mechanism pivoted same day.
|
||||
|
||||
## Motivation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user