|
3 | 3 |
|
4 | 4 | # Stdlib AOT triage — #135 punch list |
5 | 5 |
|
6 | | -**Refreshed 2026-05-17** after merging slices 1, 2, 3, 6. Live per-file |
7 | | -state of driving every `stdlib/*.affine` through |
8 | | -`resolve → typecheck → codegen` (Deno-ESM). |
| 6 | +**Refreshed 2026-05-17 (r2)** after merging #135 slices 1,2,3,5,6,6b,7,8. |
9 | 7 |
|
10 | 8 | ## Done (merged to main) |
11 | 9 |
|
12 | 10 | | Slice | What | PR | |
13 | 11 | |---|---|---| |
14 | | -| #131 | `>>` nested-generic close (keystone) | #149 | |
15 | | -| #134 | prelude unwrap/unwrap_result soundness | #150 | |
16 | | -| #132 | namespace ADR-011 | #151 | |
17 | | -| #133 | single-ownership dedup | #152 | |
18 | | -| #135 sl.1 | `fn(x) => e` anon-function expressions | #153 | |
19 | | -| #135 sl.2 | slice/range index `e[a:b]` via `slice` builtin | #154 | |
20 | | -| #135 sl.3 | bare `effect E;` + ADR-008 `-> T / E` row | #155 | |
21 | | -| #135 sl.6 | `try`→`attempt`, `ref`→`make_ref` (keyword-as-ident) | #156 | |
| 12 | +| #131/#134/#132/#133 | front (keystone/soundness/ADR-011/dedup) | #149/#150/#151/#152 | |
| 13 | +| sl.1 | `fn(x)=>e` anon-function expressions | #153 | |
| 14 | +| sl.2 | slice/range index `e[a:b]` via `slice` builtin | #154 | |
| 15 | +| sl.3 | bare `effect E;` + ADR-008 `-> T / E` row | #155 | |
| 16 | +| sl.6 | `try`→`attempt`, `ref`→`make_ref` | #156 | |
| 17 | +| sl.6b | `as`→`xs` (collections) | #158 | |
| 18 | +| sl.5 | trait default bodies (left-factored; conflicts ↓) | #159 | |
| 19 | +| **sl.7** | **let-polymorphism**: generic fn `<T>` instantiation + prelude `mut` | #163 | |
| 20 | +| sl.8 | module visibility/imports per ADR-011 | #164 | |
22 | 21 |
|
23 | 22 | ## Current sweep |
24 | 23 |
|
25 | | -| File | Stage | Site | Slice / root cause | |
26 | | -|---|---|---|---| |
27 | | -| `string` | ✅ OK | — | full pipeline | |
28 | | -| `Core` | ✅ OK | — | full pipeline | |
29 | | -| `Ajv`/`Crypto`/`Grammy`/`Network`/`Sqlite`/`Vscode`/`VscodeLanguageClient` | ✅ OK | — | full pipeline | |
30 | | -| `traits` | PARSE | `12:43` | **Slice 5** — trait method *default body* + `ref self` (`pub fn ne(ref self, ...) { ... }`) | |
31 | | -| `collections` | PARSE | `40:13` | **Slice 6b** — `as` used as a parameter name (`fn zip<A,B>(as: [A], ...)`); `as` is the AS keyword. Same class as slice 6 → rename (`elems`) | |
32 | | -| `math` | PARSE | `354:3` | **Slice 4** — `if cond { ... }` (no else) used as a statement between other statements; the parser commits to if-as-trailing-expr | |
33 | | -| `testing` | PARSE | `302:3` | **Slice 4** — record literal `{ f: v }` as the block's final expression after statements (the pre-existing `list(stmt)` vs `expr_record_body` r/r) | |
34 | | -| `option` | PARSE | `320:15` | **Slice 9** — `&mut Option<T>` reference parameter type (`fn take<T>(opt: &mut Option<T>)`); flagged in #128 itself (take/get_or_insert + affine/borrow lowering) | |
35 | | -| `result` | RESOLVE | — | **Slice 8** — module/`use prelude::{...}` resolution (post-#133 model) | |
36 | | -| `io` | RESOLVE | — | **Slice 8** — builtin/extern + namespace resolution; model-coupled | |
37 | | -| `prelude` | TYPECHECK | `Unify (T, Int)` | **Slice 7 (root cause refined)** — *not* a simple empty-array literal (that pattern compiles in isolation). Deeper type-instantiation: `fold`'s `(U,T)->U` HOF instantiated monomorphically by `sum`/`product` (`fold(arr, 0, …)` forces `0:Int`). Needs careful typecheck investigation | |
38 | | -| `effects` | TYPECHECK | "Not implemented: Too many arguments for kind" | **Slice 10** — kind-checking of generic externs (`extern fn make_ref<T>(x: T) -> Ref<T> / state`); distinct codegen/kind defect | |
39 | | - |
40 | | -9/19 compile end-to-end. Parse walls + deeper defects regroup into the |
41 | | -slices below. |
| 24 | +| File | Stage | Slice / root cause | |
| 25 | +|---|---|---| |
| 26 | +| `prelude` | ✅ OK | compiles end-to-end (sl.7 + sl.8) | |
| 27 | +| `string` `Core` + 7 module files | ✅ OK | — | |
| 28 | +| `result` | TYPECHECK | post-sl.8 deeper typecheck (imports now resolve) — **slice 12** | |
| 29 | +| `collections` | RESOLVE UndefinedVariable | `binary_search`→`binary_search_helper` — **slice 11** (resolver forward-ref) | |
| 30 | +| `io` | RESOLVE UndefinedVariable | `split` lives in `string.affine`; needs cross-module import — **slice 8-tail** | |
| 31 | +| `option` | PARSE 320 | `&mut Option<T>` ref param (`take`/`get_or_insert`) — **slice 9** | |
| 32 | +| `testing` | PARSE 302 | record-literal `{f:v}` as final block expr after stmts — **slice 4** | |
| 33 | +| `math` | PARSE 354 | `if`(no else) as a statement between stmts — **slice 4** | |
| 34 | +| `traits` | PARSE 124 | `while let` / `Vec::new()` / `let mut` mid-block — **slice 4** | |
| 35 | +| `effects` | TYPECHECK | "Too many arguments for kind" — generic-extern kind-check — **slice 10** | |
42 | 36 |
|
43 | | -## Remaining slices — difficulty & autonomy |
| 37 | +~10/19 compile end-to-end (was 9 at session start; the *highest-leverage* |
| 38 | +compiler fix — let-polymorphism, sl.7 — is the session's key win: it |
| 39 | +unblocked the entire typecheck wall). |
44 | 40 |
|
45 | | -**Safe to do autonomously (bounded, low risk):** |
46 | | -- **Slice 6b** — `as` param-name in `collections.affine` → rename |
47 | | - (`elems`/`xs`). Pure stdlib edit, zero grammar risk. ~15 min. |
48 | | -- **Slice 5** — trait default bodies + `ref self`. `trait_item` |
49 | | - already has `TraitFnDefault f` (line ~537); the gap is the `ref self` |
50 | | - receiver in trait-method position. Grammar-bounded, medium; verify |
51 | | - conflict counts. |
| 41 | +## Remaining slices — all correctness-/grammar-critical (rigorous, not auto) |
52 | 42 |
|
53 | | -**Needs care — rigorous, not auto-rushed:** |
54 | | -- **Slice 4** (testing, math) — block/statement ambiguity. The hardest: |
55 | | - `if`/`while`/`for` as statements vs trailing-expr, and record-literal |
56 | | - vs block `{`. This is the grammar's pre-existing `list(stmt)` / |
57 | | - `expr_record_body` reduce/reduce. High regression risk; needs a |
58 | | - careful block-grammar restructure with full conflict + suite |
59 | | - re-verification. Multi-step. |
60 | | -- **Slice 9** (option) — `&mut T` reference parameters with |
61 | | - reassignment. Touches affine/borrow lowering (the #128-noted hard |
62 | | - case). Correctness-critical (ownership) — must be rigorous. |
63 | | -- **Slice 7** (prelude) — type-checker instantiation of HOF `fold` |
64 | | - under monomorphic `sum`/`product`. Correctness-critical typecheck |
65 | | - code; investigate, don't guess. |
66 | | -- **Slice 8** (result, io) — module/extern resolution against the |
67 | | - post-#133 model (ADR-011). Model-coupled. |
68 | | -- **Slice 10** (effects) — generic-extern kind-checking |
69 | | - ("Too many arguments for kind"). Distinct kind/codegen defect. |
| 43 | +- **slice 4** — block/statement LR ambiguity (testing/math/traits). The |
| 44 | + grammar's pre-existing `list(stmt)` vs `expr_record_body` r/r: |
| 45 | + `if`/`while`/`for` as statements vs trailing-expr; record-literal vs |
| 46 | + block `{`; `while let`. High regression risk; careful checkpointed |
| 47 | + block-grammar restructure + full conflict re-verify. |
| 48 | +- **slice 9** — `&mut T` reference parameters with reassignment |
| 49 | + (`option` take/get_or_insert). Affine/borrow lowering; |
| 50 | + ownership-soundness-critical. |
| 51 | +- **slice 10** — generic-extern kind-checking ("Too many arguments for |
| 52 | + kind"); `effects` `extern fn make_ref<T>`. |
| 53 | +- **slice 11** (NEW, discovered in sl.8) — the resolver is single-pass |
| 54 | + with no top-level pre-registration, so **forward references between |
| 55 | + top-level functions fail** (`fn a(){ b() } fn b(){}` errors even |
| 56 | + *without* `module`). Pre-existing, affects collections and likely |
| 57 | + many files; resolver two-pass fix — resolver-critical. |
| 58 | +- **slice 8-tail** — `io` needs `split` from `string.affine` |
| 59 | + cross-module; requires `module string; pub fn split` + `use |
| 60 | + string::{split}`, then re-verify every string.affine consumer |
| 61 | + (string currently compiles — must not regress). |
| 62 | +- **slice 12** — `result` post-sl.8 deeper typecheck (separate from |
| 63 | + sl.7; surfaced once imports resolved). |
70 | 64 |
|
71 | 65 | ## Closure |
72 | 66 |
|
73 | | -#135 closes when all files compile resolve→typecheck→codegen; then |
74 | | -#138 (remove b895374 band-aid), #136 (CI AOT smoke gate), #137 |
75 | | -(multi-module integration test). The safe slices (6b, 5) are ~1 short |
76 | | -session; slices 4/7/8/9/10 are correctness-/grammar-critical and are |
77 | | -each their own focused, rigorous unit (the "rigorous over partial-hack" |
78 | | -discipline applies — no guessed changes to typecheck/borrow/block |
79 | | -grammar). |
| 67 | +#135 closes when all files compile resolve→typecheck→codegen, then |
| 68 | +#138/#136/#137. Slices 4/9/10/11/12 + 8-tail each remain their own |
| 69 | +rigorous, focused unit (per the "rigorous over partial-hack" |
| 70 | +discipline — no unattended changes to the block grammar, borrow |
| 71 | +checker, kind checker, or resolver two-pass). The two highest-impact |
| 72 | +remaining are **slice 11** (resolver forward-ref — likely unblocks |
| 73 | +several files at once) and **slice 4** (3 files). |
0 commit comments