Repository navigation
INT-01: cross-module WASM import emission (substrate) #178
Description
Activity
- addedmajorMajor issue — significant scope, broader impact than a feature/bugMajor issue — significant scope, broader impact than a feature/bug
on May 18, 2026 Finding (compiler-as-oracle): the emission substrate already works for the canonical form.
lib/codegen.ml gen_importsemits a real(import "Mod" "fn" (func ...))foruse Mod::{fn}/use Mod::*, and the.wasmpath feeds the import-shaped program. Two separately-compiled.wasmmodules link and execute: compiledCrossCallee.affine→ callee (exportsconsume) andcross_caller_ok.affine→ caller (importsCrossCallee.consume), instantiated linked in Deno,main()returned 42 via the cross-module call.What was missing was the guarantee (existing xmod tests are structural
Tw_interfaceonly). Now locked by PR #244:- Hermetic structural test in the gate (270 → 271): caller emits import
(CrossCallee . consume), callee exportsconsume. - Reproducible deno link+execute harness:
tests/modules/xmod-link/(run.sh+link.mjs+ README).
use Mod::{fn}/use Mod::*multi-file libraries are shippable, proven, regression-locked.Remaining (distinct — issue kept open):
use Mod;+ qualified value callMod.fn(x)hits a resolution error (post-#228 qualified-value resolution is unwired; fails before codegen). This is a separate follow-up, not the emission substrate. Ledger truthed:docs/TECH-DEBT.adoc+docs/ECOSYSTEM.adocINT-01.- Hermetic structural test in the gate (270 → 271): caller emits import
- added a commit that references this issue
on May 19, 2026 Closing as completed — the emission substrate (this issue's scope) is done, proven, and regression-locked.
PR #244 merged (
2026-05-19):lib/codegen.ml gen_importsemits real(import "Mod" "fn" (func ...))foruse Mod::{fn}/use Mod::*; two separately-compiled.wasmmodules link and execute (main()→ 42). Now guaranteed by a hermetic structural test in the gate (270 → 271) plus a reproducible Deno link+execute harness attests/modules/xmod-link/.use Mod::{fn}/use Mod::*multi-file libraries are shippable, proven, regression-locked. Ledger truthed indocs/TECH-DEBT.adoc+docs/ECOSYSTEM.adoc(INT-01).The merge check
governance / Language / package anti-pattern policyfailed on pre-existing ReScript files (packages/affine-res/,affinescriptiser/examples/) entirely outside this PR's diff (test + docs only, 0.resfiles) — baseline rot, not a PR defect; the affine oracle (build/dune test gate) was green. Admin-merged on that basis.The remaining distinct item —
use Mod;+ qualified value callMod.fn(x)failing at resolution (post-#228 qualified-value resolution unwired, fails before codegen) — is not the emission substrate and is split out to #249.- added 6 commits that reference this issue
on May 19, 2026 - added a commit that references this issue
on May 30, 2026
use A.B inlines at AST level; no real multi-file libraries shippable. gen_imports + verify-boundary exist for hand-assembled callers. Blocks INT-04/05/07/09/12 and every multi-file satellite. Ledger: INT-01 (S1, substrate).