You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds source-level Cmd linearity to the QTT quantity checker:
- typecheck.ml: register Cmd as KArrow(KType,KType); add cmd_none and
cmd_perform builtins to the type environment
- resolve.ml: expose cmd_none and cmd_perform as built-in names
- quantity.ml:
- is_cmd_type / quantity_of_ty_annotation: infer QOne from Cmd[_]
type annotations on let-bindings (ExprLet + StmtLet)
- infer_usage_block: declare QOne locals in env before processing
subsequent statements so uses are tracked; check at block end
(LinearVariableUnused fired when Cmd is dropped)
- interp.ml: runtime values for cmd_none (VUnit) and cmd_perform
- test/e2e/fixtures/cmd_linear.affine: Cmd returned in tuple → OK
- test/e2e/fixtures/cmd_dropped.affine: Cmd dropped → quantity error
- test/test_e2e.ml: 4 new E2E Cmd Linearity tests (173/173 pass)
The AffineScript TEA guarantee: a forgotten Cmd side-effect obligation
is now a compile-time type error, not a silent behavioural bug.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-⚠️**Type Checker:**Rules implemented (bidirectional inference in `lib/typecheck.ml`), but **experimental (enforcement landing soon)** — not yet wired into `check`/`compile`/`eval` CLI paths
127
-
-⚠️**Affine Types / QTT:****experimental (enforcement landing soon)** — quantity semiring in `lib/quantity.ml` exists but is not called from `bin/main.ml`
128
-
- ⚠️ **Borrow Checker:****experimental (enforcement landing soon)** — `lib/borrow.ml` carries `[IMPL-DEP: Phase 3]` markers; runtime checks in interpreter only
125
+
- ✅ **Lexer & Parser:** Complete (quantity sugar `:0/:1/:ω` and attribute form `@erased/@linear/@unrestricted` accepted)
126
+
-✅**Type Checker:**Wired into `check`/`compile`/`eval` CLI paths
127
+
-✅**Affine Types / QTT:**Live gate (`Quantity.check_program_quantities` runs in standard CLI pipeline)
128
+
- ⚠️ **Borrow Checker:**Live gate with ongoing Phase 3 work
129
129
- ⚠️ **Dependent / Refinement Types:** parse-only — `TRefined` AST node exists but predicates do not reduce
**Recommendation:** For current development, use WASM deployment targeting browsers. For future-proof design, plan for native and GPU backends coming in later releases.
*Honest status (2026-04-10):* AffineScript's affine types, QTT quantity checking, borrow checker, and dependent types are **experimental (enforcement landing soon)**. The type-checking rules for these features are implemented in `lib/typecheck.ml` and `lib/quantity.ml`, but they are not yet wired into the `check`/`compile`/`eval` CLI paths, so user programs are not gated on them today. Track A of the Manhattan plan closes this gap; ETA T+7d. See `.machine_readable/6a2/STATE.a2ml` `[features]` for the per-feature honest breakdown.
17
+
*Honest status sync (2026-04-12):* Affine/QTT and borrow checking are wired into the CLI pipeline (`check`, `compile`, `eval`) and gate user programs today. Specifically, `Typecheck.check_program`, `Borrow.check_program`, and `Quantity.check_program_quantities` are all invoked from `bin/main.ml`. Dependent/refinement types remain parse-first (predicates do not reduce yet), and codegen backends still have feature gaps (notably effect-handler lowering in Wasm backends). See `.machine_readable/6a2/STATE.a2ml` `[features]` for the authoritative per-feature status.
18
18
====
19
19
20
20
AffineScript is the only language that combines affine types, quantitative type theory, row polymorphism, and algebraic effects in a single practical systems language. This means you can write game code where the compiler *proves* your protocol states, resource lifecycles, and effect boundaries are correct -- with syntax that feels like a modern game scripting language, not a theorem prover.
@@ -124,15 +124,15 @@ AffineScript's type system proves your game logic is correct at compile time. No
124
124
// Game resource that MUST be properly managed
125
125
type GameTexture = own { id: Int, width: Int, height: Int }
**Version 0.8 Frontend Complete:** The frontend surface syntax for core type features (Linear Arrows `-[q]->`, Generic Variants, Refinement Types, Kind Checking) parses and elaborates. Note: several of these features are *experimental (enforcement landing soon)* — the quantity checker is not yet called from the CLI, the lexer does not yet emit ZERO/ONE quantity literal tokens, and refinement predicates parse but do not reduce. See `.machine_readable/6a2/STATE.a2ml` `[features]` for per-feature status.
327
+
**Status sync (2026-04-12):** This section is aligned with `.machine_readable/6a2/STATE.a2ml`.
328
+
Core affine/QTT and borrow gates are live in the standard CLI paths. Dependent/refinement types are still parse-only. Effects run in the interpreter; Wasm backend support is still partial for handlers/resume semantics.
328
329
329
-
NOTE: As of v0.8, the standard file extension for AffineScript is `.affine` (formerly `.affine`, changed to avoid clashes with ActionScript).
330
+
NOTE: The standard file extension for AffineScript source is `.affine`.
330
331
331
-
AffineScript is in active development. The frontend is solid; the backend and advanced type features are in progress.
332
+
AffineScript is in active development with active weekly commits and a passing `dune runtest` baseline.
332
333
333
334
[cols="2,1,3"]
334
335
|===
@@ -343,51 +344,56 @@ AffineScript is in active development. The frontend is solid; the backend and ad
343
344
|Module loader, scope analysis, import system
344
345
345
346
|Type Checker
346
-
|Working
347
-
|Bidirectional inference, unification, let-polymorphism. Quantities and effects not yet integrated into inference.
347
+
|Wired
348
+
|Bidirectional inference/unification active in `check`/`compile`/`eval` pipeline.
348
349
349
350
|Effect System
350
-
|Declarations only
351
-
|Effect types parsed and tracked; handler semantics not yet in interpreter or backends
351
+
|Interpreter complete
352
+
|Effect operations + handlers + `resume` wired in interpreter. Wasm backends have handler-dispatch limitations.
352
353
353
354
|Quantity Checking
354
-
|Separate pass
355
-
|Usage tracking works; needs integration with type checker for full QTT
355
+
|Live gate
356
+
|QTT quantity checks run after typecheck and fail builds on violations.
356
357
357
358
|Borrow Checker
358
-
|Partial
359
-
|Affine tracking at runtime in interpreter; compile-time checking in progress
359
+
|Live gate (Phase 3 in progress)
360
+
|Compile-time borrow checks run in CLI pipeline; advanced phases still in progress.
360
361
361
362
|Trait System
362
-
|Skeletal
363
-
|Registry and lookup work; generic trait resolution needs unification integration
363
+
|Partial
364
+
|Registry + unification-based impl lookup wired; associated-type/coherence work remains.
364
365
365
366
|Interpreter
366
-
|75%
367
-
|Closures, pattern matching, builtins. No effect handlers or exceptions yet.
367
+
|95%
368
+
|Closures, pattern matching, effects, and recent try/catch/finally plumbing.
368
369
369
370
|WASM Codegen
370
-
|30%
371
-
|Basic arithmetic, functions, closures. Types collapse to i32; records missing.
|GC backend available via `--wasm-gc`; not full feature parity with interpreter.
372
377
373
378
|Julia Codegen
374
-
|10%
375
-
|Phase 1 MVP skeleton only
379
+
|Phase 1
380
+
|Basic generation path exists; not the primary deployment backend.
376
381
377
382
|LSP Server
378
-
|Phase A done
379
-
|JSON diagnostics via `--json`; go-to-definition and references pending
383
+
|Complete (Phases A-D)
384
+
|`server --stdio` shipped with hover, goto-def, completion, diagnostics.
380
385
381
386
|Formatter + Linter
382
387
|Complete
383
388
|AST-based formatter; 4 lint rules
384
389
|===
385
390
386
-
=== Roadmap: v0.8 to v0.9
387
-
The immediate priority for v0.9 is to fully propagate the v0.8 language features down through the entire stack, solidifying the architecture for the **Airborne Submarine Squadron** remake:
388
-
* Propagate v0.8 syntax (like `-[q]->`), semantics, and type system upgrades down through the AST, Interpreter, REPL, and Standard Library.
389
-
* Update the compiler backend (WASM generation) to fully support the newly checked Generic Variants and Refinement constraints.
390
-
* Finalize the metacompiler and metainterpreter features.
391
+
=== Next Priorities (Post-Sync)
392
+
The immediate priorities are execution and drift control:
393
+
* Keep `README`, `ROADMAP`, `COMPILER-CAPABILITIES`, and `.machine_readable/6a2/STATE.a2ml` synchronized on each feature milestone.
394
+
* Finish parser/README/example syntax convergence around effects and quantity annotations.
395
+
* Close remaining backend gaps for effect handler lowering so interpreter and Wasm behavior converge.
396
+
* Keep `examples/` parse-checkable in CI to prevent documentation drift from reappearing.
0 commit comments