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:
WasmExports type
wasmInstance(bytes) -> WasmExports
readFile
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
Refs
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 aWasmExportsvalue, from AffineScript code.stdlib/Deno.affinealready exposes:WasmExportstypewasmInstance(bytes) -> WasmExportsreadFileWhat's missing is the calling surface — given a
WasmExportsvalue, how do you actually call individual exports by name?Why
vm/wasm(740 LoC across 2 files) is blocked here today.Two approaches (pick one)
Option A — Generic dynamic call: one extern, ~10 lines:
Pros: tiny surface, future-proof. Cons: stringly-typed, no compile-time check that the export exists.
Option B — Per-export typed externs: ~30
extern fndeclarations 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.affineextension, or a newstdlib/wasm.affine(decide as part of this issue).Done when
vm/wasmwould be the natural one)docs/bindings-roadmap.adoc(status row updated◐→●)Refs
docs/bindings-roadmap.adoc— bindings ci: Bump actions/github-script from 7.0.1 to 8.0.0 #5stdlib/Deno.affine— currentWasmExportssurface