diff --git a/current/CHECKPOINT-EXTERN-EXPORT.md b/current/CHECKPOINT-EXTERN-EXPORT.md index 40a384f..d947f83 100644 --- a/current/CHECKPOINT-EXTERN-EXPORT.md +++ b/current/CHECKPOINT-EXTERN-EXPORT.md @@ -5,15 +5,29 @@ Companion to `current/PLAN-EXTERN-EXPORT.md` — one merged plan: **Part A** add every commit, one step at a time per the cadence rule. ## Last completed step -**Phase 6.1 — migrate `vendors/sqlite` `#foreign`→`extern`** (`refactor` commit +**Phase 6.2 — migrate `platform/` `#foreign`→`extern`/`export`** (`refactor` commit +`2cd5d7b`). Pure source rename across uikit/android/android_jni/sdl3 (~64 sites): +30 fn `… #foreign;`→`… extern;`; 34 import runtime classes +`#foreign #objc_class/#jni_class("X") {`→`#…_class("X") extern {` (prefix→postfix); +4 defined `Sx*` obj-c classes `#objc_class("X") {`→`… export {`. Behavior-preserving; +empty snapshot diff. **Verification (these modules are largely uncompiled by the +host corpus** — bundle examples import `bundle.sx`, not the runtime modules; android.sx +only compiles under `OS==.android`): byte-identical `sx ir` on uikit importers 1610 + +1606 (which DO compile uikit incl. the 4 defined `Sx*` classes on host) and an sdl3 +direct-import probe; android.sx verified by an identical 4-error dedup set (host +pthread clashes — the keyword-neutral "foreign symbol already bound" dedup message is +unchanged, and the probe parsed all migrated `extern` jni classes + EGL fns cleanly +before hitting them). Suite green (647 corpus / 444 unit, 0 failed). Remaining Phase 6 +batches: 6.3 std (~60), 6.4 ffi (~50), 6.5 remainder. + +### Prior: Phase 6.1 — migrate `vendors/sqlite` `#foreign`→`extern` (`refactor` commit `410a52e`). **PART B PHASE 6 STARTED.** Pure source rename: all 97 `sqlite3_* … #foreign sqlib "csym";` fn decls → `extern sqlib "csym";` (+ the one stale header-comment reference, line 9). The `extern_lib` axis references the `sqlib` `#import c` unit identically to `#foreign sqlib`, so IR/output is byte-identical — empty snapshot diff (only `sqlite.sx` changed), and example 1624 (`vendor-sqlite-module`) stdout byte-unchanged. Suite green (647 corpus / 444 unit, -0 failed). Remaining Phase 6 batches: 6.2 platform (~95), 6.3 std (~60), 6.4 ffi -(~50), 6.5 remainder. +0 failed). ### Prior: Phase 5.1 — annotate A→B gate post-flip + add fn-rename case (`test` commit `93e7b6f`). **PHASE 5 COMPLETE → PART B Phase 5 done.** The A→B gate @@ -170,23 +184,23 @@ AOT), 1227 (export fn rename, AOT), 1348 (objc extern class), 1349 (objc export (jni extern class), 1174/1175 (interplay diagnostics). ## Next step -**PART B — Phase 6.2 (migrate `library/modules/platform/` `#foreign`→`extern`, -~95 sites).** Phase 6.1 (sqlite) is COMPLETE. +**PART B — Phase 6.3 (migrate `library/modules/std/` `#foreign`→`extern`, ~60 +sites).** Phase 6.1 (sqlite) + 6.2 (platform) COMPLETE. -- **Phase 6.2** (`refactor`, snapshot diff must be EMPTY): rewrite - `library/modules/platform/` (uikit/android/android_jni/sdl3) `#foreign`→`extern` - (fns/globals), `#foreign #objc_class`→`#objc_class … extern`, defined classes → - `… export`. ⚠ Unlike sqlite (uniform fn decls), platform mixes Obj-C/JNI runtime - CLASSES — those use the **postfix** form (`#objc_class("X") extern { … }` for a - reference/import class == `#foreign #objc_class`; `… export` for a defined class == - bare `#objc_class`). Check each `#foreign` site's shape before bulk-replacing; a - naive `s/#foreign //` is WRONG for the class-prefix form. Pure SOURCE rename, IR - byte-identical; a non-empty diff ⇒ a reader still branches on `foreign_expr` - structurally → STOP and coalesce first (don't regen). -- **Remaining Phase 6 batches:** 6.3 `library/modules/std/` - (socket/thread/fs/time/process, ~60), 6.4 `library/modules/ffi/` - (objc/raylib/objc_block, ~50), 6.5 remaining `library/`+`vendors/`. Then **Phase 7** - migrates examples + issues the same way. +- **Phase 6.3** (`refactor`, snapshot diff must be EMPTY): rewrite + `library/modules/std/` (socket/thread/fs/time/process/…) `#foreign`→`extern`. Mostly + libc fn decls (bare `#foreign;` or `#foreign "csym";`); check for any data-global + `#foreign` too. These ARE exercised by the host corpus (fs/process/socket examples), + so a non-empty snapshot diff catches a regression directly — STOP and coalesce, don't + regen. Transform: `s/ #foreign;/ extern;/` for bare, plus the `#foreign "csym"`/ + `#foreign LIB "csym"` rename forms where present (verify per-file first like 6.2). +- **Remaining Phase 6 batches:** 6.4 `library/modules/ffi/` (objc/raylib/objc_block, + ~50 — has runtime classes, use the postfix shape like 6.2), 6.5 remaining `library/`+ + `vendors/`. Then **Phase 7** migrates examples + issues the same way. +- **6.2 verification note (carry forward):** the `platform/` runtime modules + (uikit/android/android_jni) are NOT compiled by any marker'd host corpus test — verify + future platform-adjacent migrations via direct `sx ir` on importers (1610/1606 compile + uikit on host) or import probes, not the corpus alone. - **Phases 6–7** (`refactor` batches, empty snapshot diff per batch): migrate the stdlib + examples from `#foreign` spelling to `extern`. Because the AST is already unified, this is a pure SOURCE rename (`… #foreign LIB "sym";` → `… extern LIB "sym";` @@ -309,6 +323,13 @@ Part A ratified (bare / postfix / `⇒ callconv(.c)` / lib-separate). Part B: deleted at cutover). Affects only diagnostic wording — IR/behavior identical either way. ## Log +- (6.2 platform) Migrated `platform/` (uikit/android/android_jni/sdl3, ~64 sites): + 30 fn `#foreign;`→`extern;`, 34 import classes prefix `#foreign #objc/jni_class`→ + postfix `… extern {`, 4 defined `Sx*` objc classes → `… export {`. Behavior- + preserving, empty snapshot diff. Verified byte-identical `sx ir` on uikit importers + 1610/1606 + sdl3 probe; android via identical 4-error dedup set (host-only module). + Suite green (647/444). `refactor` `2cd5d7b`. NOTE: these runtime modules aren't in + the marker'd host corpus — verified out-of-band. - (6.1 sqlite) **PHASE 6 STARTED.** Migrated `vendors/sqlite/sqlite.sx`: 97 `… #foreign sqlib "csym";` fn decls → `extern sqlib "csym";` (+ line-9 comment). `extern_lib` references the `sqlib` `#import c` unit like `#foreign sqlib`; IR