Repository navigation
Description
Child issue of #411 (bindings umbrella). Item bindings #5 in docs/bindings-roadmap.adoc.
What
Provide a way to invoke individual exports.fn_name(args) from a WasmExports value, from AffineScript code.
stdlib/Deno.affine already exposes:
WasmExportstypewasmInstance(bytes) -> WasmExportsreadFile
What's missing is the calling surface — given a WasmExports value, how do you actually call individual exports by name?
Why
- Idaptik
vm/wasm(740 LoC across 2 files) is blocked here today. - Every future WASM-host integration in the estate will need this surface.
- Smallest scope / highest leverage Tier-1 item in the bindings roadmap.
Two approaches (pick one)
Option A — Generic dynamic call: one extern, ~10 lines:
extern fn wasm_call(exports: WasmExports, name: String, args: [Float]) -> Float
Pros: tiny surface, future-proof. Cons: stringly-typed, no compile-time check that the export exists.
Option B — Per-export typed externs: ~30 extern fn declarations matching the specific exports idaptik's vm/wasm Zig module ships.
Pros: typed, compile-time-checked. Cons: brittle to changes in the Zig module's export list.
The roadmap doc leans toward Option A as the generic surface, with Option B's typed shape achievable via per-consumer wrapper modules layered on top.
Where it lives
stdlib/Deno.affine extension, or a new stdlib/wasm.affine (decide as part of this issue).
Done when
- AS-side surface lands (extern fn(s) declared)
- Host-side glue lands (Deno side)
- At least one consumer demonstrates the round-trip (idaptik
vm/wasmwould be the natural one) - Documented in
docs/bindings-roadmap.adoc(status row updated◐→●) - Idaptik PR Cross-module imports: TopConst not threaded by gen_imports / flatten_imports #107 successor unblocked on this dimension
Refs
docs/bindings-roadmap.adoc— bindings ci: Bump actions/github-script from 7.0.1 to 8.0.0 #5- Idaptik PR Cross-module imports: TopConst not threaded by gen_imports / flatten_imports #107 (the pilot that surfaced this need)
stdlib/Deno.affine— currentWasmExportssurface
Activity
feat(stdlib): motion library binding (bindings #4) (#422)
feat(bindings): close bindings roadmap #5 — AS-side wasmCall surface (#…
feat(stdlib): wasmCall extern for invoking WebAssembly exports by name (
fix(codegen-deno): WASI stub in __as_wasmInstance — instantiate affin…