Skip to content

INT-01: cross-module WASM import emission (substrate) #178

Closed

Description

@hyperpolymath

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).

Activity

  1. added
    major
    on May 18, 2026
  2. hyperpolymath commented on May 19, 2026

    @hyperpolymath
    OwnerAuthor

    Finding (compiler-as-oracle): the emission substrate already works for the canonical form.

    lib/codegen.ml gen_imports emits a real (import "Mod" "fn" (func ...)) for use Mod::{fn} / use Mod::*, and the .wasm path feeds the import-shaped program. Two separately-compiled .wasm modules link and execute: compiled CrossCallee.affine → callee (exports consume) and cross_caller_ok.affine → caller (imports CrossCallee.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_interface only). Now locked by PR #244:

    • Hermetic structural test in the gate (270 → 271): caller emits import (CrossCallee . consume), callee exports consume.
    • 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 call Mod.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.adoc INT-01.

  3. hyperpolymath commented on May 19, 2026

    @hyperpolymath
    OwnerAuthor

    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_imports emits real (import "Mod" "fn" (func ...)) for use Mod::{fn} / use Mod::*; two separately-compiled .wasm modules link and execute (main() → 42). Now guaranteed by a hermetic structural test in the gate (270 → 271) plus a reproducible Deno link+execute harness at tests/modules/xmod-link/. use Mod::{fn} / use Mod::* multi-file libraries are shippable, proven, regression-locked. Ledger truthed in docs/TECH-DEBT.adoc + docs/ECOSYSTEM.adoc (INT-01).

    The merge check governance / Language / package anti-pattern policy failed on pre-existing ReScript files (packages/affine-res/, affinescriptiser/examples/) entirely outside this PR's diff (test + docs only, 0 .res files) — 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 call Mod.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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    major

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions