|
Important
|
This document defines the spine (the macro-stage structure of the language
build-out), the actual AffineScript ↔ typed-wasm contract, the satellite
registry, and the INT-01..12 integration roadmap. It is authoritative for
those four things; for per-feature readiness see
CAPABILITY-MATRIX.adoc. Reconstructed 2026-05-19
from issues #128/#135, #175–183, #215, #225, #228, #177, #234, #235 and the
|
Two distinct things have been called "the spine"; this document keeps them separate.
The set of compiler modules that the affine discipline is threaded through, end to end. Any change to the affine/borrow/quantity/codegen contract touches all of them in lock-step:
lib/ast.ml, lib/parser.mly, lib/quantity.ml, lib/typecheck.ml,
lib/borrow.ml, lib/interp.ml, lib/codegen.ml, lib/codegen_gc.ml,
lib/tw_interface.ml, lib/tw_verify.ml, lib/julia_codegen.ml,
lib/formatter.ml, lib/json_output.ml, lib/linter.ml,
test/e2e/fixtures/, docs/spec.md.
The language build-out proceeds in five macro stages. These definitions are established by this document (the prior ledger was never committed).
| Stage | Scope | Status | Evidence / exit criterion |
|---|---|---|---|
A |
Core affine spine: QTT semiring wired into the CLI pipeline; affine types + linear arrows enforced; BUG-001..005 closed (Manhattan/Track-A recovery). |
CLOSED |
|
B |
Grammar conformance + conflict elimination: ADR-009 conformance, the #215 conflict-family workstream, ADR-012 ("grammar changes are correctness assertions"). |
CLOSED |
#215 closed with an owner-ratified ADR-012
disposition: families A/C/D/F + the EXTERN bug fixed on correctness
grounds (#216/#217/#219/#222/#223); family B ( |
C |
Standard library AOT: every stdlib file compiles resolve→typecheck→codegen, gated in CI. |
CLOSED 2026-05-18 |
19/19 stdlib
files; |
D |
Base-language soundness + ecosystem connective tissue: CORE-01 borrow Phase-3 (#177); the INT-01..12 integration roadmap; the satellite registry made real; #228/ADR-014 module-qualified paths (estate port unblocker). |
ACTIVE — current frontier |
This stage. Substrate = INT-01..04 + CORE-01. |
E |
typed-wasm convergence hardening (the transition runway): the AffineScript↔typed-wasm contract widened from L7+L10 toward full L1–6/L13–16 emitted-wasm enforcement; estate-wide re-validation (#235); effect-threaded async-boundary recogniser (#234); the #225/#160 convergence ABI matured to "shared with Ephapax". |
planned |
Begins when D’s substrate (INT-01..04, CORE-01) is closed; ends at a stable, multi-producer typed-wasm convergence ABI. |
The transition the mandate refers to — "end of E into typed-wasm" — is not
a hand-off into a different project. It is the point at which AffineScript’s
emitted typed-wasm satisfies enough of the hyperpolymath/typed-wasm level
discipline that the separate typed-wasm verifier accepts AffineScript output
on the same footing as the other producers (ephapax). See the contract below.
|
Important
|
typed-wasm is a separate, language-agnostic compilation target with its own
repository ( |
The contract is narrower than older prose claimed and is exactly this:
-
Carrier. AffineScript emits ordinary WASM/WASM-GC. The typed-wasm discipline rides on it via the
affinescript.ownershipcustom section (per-function param ownership kinds:0=Unrestricted,1=Linear,2=SharedBorrow,3=ExclBorrow) plus theaffinescript.tea_layoutsection where a TEA bridge is involved. -
Producer side (in this repo).
lib/codegen.ml(QTT pass) enforces the discipline on the source;lib/tw_interface.mlperforms cross-module boundary verification (verify-boundary CALLEE CALLER,LinearImportCalledMultiple,LinearImportDroppedOnSomePath);lib/tw_verify.mlre-checks the emitted module post-codegen. -
Spec / verifier side (separate repo).
hyperpolymath/typed-wasmv1.5 carries the L1–L16 Idris2 proofs andcrates/typed-wasm-verify(Rust), a faithful port of the OCaml reference here. The OCaml files remain the spec of record until the cross-compat suite is supplemented with real AffineScript-emitted fixtures (typed-wasm "C5.1", deferred). -
Coverage today. Emitted-wasm enforcement is Level 7 (aliasing)
Level 10 (linearity), plus Level 13 (module isolation, negative form) —Tw_verify.verify_module_isolationrejects a module that owns linear memory yet also imports a memory/table (carrier-free; no ownership-section ABI change). L1–6, L14–16 (region schema, session protocols, resource capabilities, agent choreography) remain proven at the spec level but not enforced on AffineScript-emitted wasm: they require a new carrier section (region/type-schema or capability data), which is a multi-producer ABI change coordinated withhyperpolymath/typed-wasm+ephapax— not made unilaterally here. Further widening + INT-12 is the rest of Stage E. -
Other producers.
ephapax(src/ephapax-wasm) already emits the sameaffinescript.ownershipsection and exposes the verifier viaephapax compile --verify-ownership. Any change to the section format is a multi-producer ABI change and must be coordinated with typed-wasm (Refs the typed-wasm repo), not made unilaterally here.
| Satellite | Reality | Notes |
|---|---|---|
|
reconciler (compiles) |
INT-08 (#183): |
|
skeleton |
Migration-prerequisite scaffold (#56). |
|
scaffold |
Build-tool integration shell. |
|
works |
Smoke-test harness used by the Deno-ESM target. |
|
runtime |
INT-07 (#182): real host-side TEA runtime
+ run loop ( |
|
scaffold |
Was imaginary until #175. INT-02 (#179) builds the host-agnostic loader. Blocks INT-05/08/11. |
|
scaffold |
Was imaginary until #175. Router/navigation
satellite (internal |
|
adjunct |
In-tree tooling/experiments; not part of the integration critical path. |
|
works |
|
Critical path: INT-01..INT-04 are substrate and block most satellites. Filed sub-issues are children of #175; severity/blocked-by also in TECH-DEBT.adoc.
| ID | Item | Issue | Status |
|---|---|---|---|
INT-01 |
Cross-module WASM import emission (the substrate) |
#178 |
|
INT-02 |
Host-agnostic loader bridge ( |
#179 |
loader
in |
INT-03 |
WASI preview2 / host I/O beyond stdout |
#180 |
S1, ADR-015
ACCEPTED (owner-chosen full WASM Component-Model re-target). Staged
S1..S6; legacy preview1 stdout path is the default until S6
(reversible-in-progress). S2 toolchain provisioned (#251). S3
DONE: |
INT-04 |
Publish compiler + runtime to JSR (then npm) |
#181 |
runtime
packaging READY (affine-js + affinescript-tea JSR dry-run green;
manual-only |
INT-05 |
Loader-driven multi-module app bundling |
ledger-only |
planned (blocked by INT-02) |
INT-06 |
Server-side runtime profile (on INT-03 WASI p2) |
ledger-only |
planned (blocked by INT-03) |
INT-07 |
|
#182 |
runtime + run loop
shipped ( |
INT-08 |
DOM reconciler in |
#183 |
reconciler
implemented + compiles (resolve→typecheck→codegen→wasm); |
INT-09 |
|
ledger-only |
planned (blocked by INT-07) |
INT-10 |
LSP distribution ( |
#282 |
unblocked — distribution decided (ADR-019: Releases + thin Deno/JSR shim, #260). Consumes the shim once #260 S2/S3 land |
INT-11 |
Browser host parity (DOM loader + reconciler end-to-end) |
ledger-only |
planned (blocked by INT-02/08) |
INT-12 |
typed-wasm convergence: AffineScript-emitted fixtures into the typed-wasm cross-compat suite (closes the Stage-E runway) |
ledger-only |
planned (Stage E; coordinates with |
INT-05/06/09/10/11/12 are ledger-only (defined here, not yet filed as issues) by deliberate choice: they are unblocked only after their substrate lands, and filing them now would create stale critical-path noise. They are filed when their blocker closes.
-
CAPABILITY-MATRIX.adoc — authoritative per-feature readiness.
-
TECH-DEBT.adoc — the coordination ledger.
-
RESCRIPT-ELIMINATION.adoc — the estate ReScript-surface elimination ledger (#229), the spine’s estate-port arm.
-
hyperpolymath/typed-wasmLEVEL-STATUS.md— the target spec & proofs. -
hyperpolymath/ephapax— the other typed-wasm producer.