|
| 1 | +<!-- SPDX-License-Identifier: PMPL-1.0-or-later --> |
| 2 | +<!-- SPDX-FileCopyrightText: 2026 hyperpolymath --> |
| 3 | + |
| 4 | +# Session handoff (b) — #128/#135 stdlib AOT, continued |
| 5 | + |
| 6 | +Continues `SESSION-HANDOFF-2026-05-18.md`. Single session, sole driver |
| 7 | +(the parallel session was stopped). Read the triage doc + this. |
| 8 | + |
| 9 | +## State |
| 10 | + |
| 11 | +stdlib **13/19 compile** `resolve→typecheck→borrow` on `main` |
| 12 | +(was 11). 7 PRs merged this run (#167, #170, #172, #173, #174, #184, |
| 13 | +plus the earlier slice-10/trunc), each gated on full suite **233/233**, |
| 14 | +zero regression. |
| 15 | + |
| 16 | +The import/builtin **infrastructure is now solid** (this was the bulk |
| 17 | +of the work — io.affine surfaced a 5-layer systemic stack, all fixed): |
| 18 | + |
| 19 | +- **#172** imported modules now get builtin-seeded resolve + typecheck |
| 20 | + contexts (`seed_builtins` shared; `register_builtins` called in the |
| 21 | + import path); ADR-011 `use module::{...}` works end to end. |
| 22 | +- **#173** `register_builtins` reconciled with the resolver seed list — |
| 23 | + file-I/O / env / time / float-math family + `read_line` → `Result`. |
| 24 | +- **#174** imported type-schemes threaded into `check_program` |
| 25 | + (`~import_types`), so cross-module *values* type-check. |
| 26 | +- **#184** `math.affine` green (`to_float` → `float(n)`; 8 `let mut`). |
| 27 | + |
| 28 | +ADR-011 module model is **ruled**: explicit `use module::{...}`, |
| 29 | +`pub` required (not flat-namespace, not prelude-hub). |
| 30 | + |
| 31 | +## Remaining to close STAGE A |
| 32 | + |
| 33 | +6 files, each a span-less typecheck/parse hunt — one PR each: |
| 34 | + |
| 35 | +| file | error | note | |
| 36 | +|---|---|---| |
| 37 | +| collections | `Unify (Array, (_ -> Bool))` | HOF/filter scheme | |
| 38 | +| io | `Unify (String, Array[String])` | `split` `[String]` at use-site | |
| 39 | +| option | parse `320:15` | slice 9 `&mut Option<T>`; hardest, do last | |
| 40 | +| result | `Unify ((_->_), T)` | generic instantiation | |
| 41 | +| testing | `Unify ((Unit->TestResult), TestResult)` | fn ref vs call | |
| 42 | +| traits | `Unify (ref _, Int)` | ref/borrow scheme | |
| 43 | + |
| 44 | +Then closers: **#138** (remove the `typecheck.ml` "If without else |
| 45 | +returns Never" debug `eprintf`) → **#136** (CI stdlib-wide AOT smoke |
| 46 | +gate) → **#137** (multi-module integration test). |
| 47 | + |
| 48 | +## Build |
| 49 | + |
| 50 | +``` |
| 51 | +cd /home/hyperpolymath/dev/affinescript |
| 52 | +export PATH="/usr/bin:$PATH" |
| 53 | +eval $(opam env --switch=/home/hyperpolymath/dev/affinescript --set-switch) |
| 54 | +dune build && dune test # must stay 233/233 |
| 55 | +./_build/default/bin/main.exe check stdlib/<f>.affine |
| 56 | +``` |
| 57 | + |
| 58 | +When sweeping, filter the stray `If without else returns Never` |
| 59 | +stderr line (a debug `eprintf`, not a failure — closer #138 removes it). |
| 60 | + |
| 61 | +## Method (kept) |
| 62 | + |
| 63 | +One file per PR; reproduce with `check`; errors carry no span so read |
| 64 | +and reason; most failures are simple **stdlib** bugs (`let`→`let mut`, |
| 65 | +`n+0.0`→`float(n)`, missing `use`/`pub`) not compiler bugs — prefer the |
| 66 | +stdlib fix. Full sweep + `dune test` before every commit; zero |
| 67 | +regression mandatory. `Refs #128`, squash-merge, mirror status on the |
| 68 | +#128 thread. Rigorous triage over a partial hack; don't guess at |
| 69 | +typecheck/borrow internals. |
0 commit comments