feat(stdlib): wasmCall extern for invoking WebAssembly exports by name#440
Merged
Conversation
Adds the generic Option A surface from bindings #5: a single extern that lowers to `exports[name](...args)` on the --deno-esm backend, with Number coercion so i32/i64/f32/f64 returns all coerce to Float at the AffineScript boundary. This is the smallest-scope / highest-leverage Tier-1 binding item — it unblocks idaptik vm/wasm (740 LoC) and every future WASM-host integration. Typed per-Zig-fn shims can layer on top per-consumer where typing discipline outweighs the generic surface's flexibility. Surface: pub extern fn wasmCall( exports: WasmExports, name: String, args: [Float] ) -> Float; Lowering (lib/codegen_deno.ml): __as_wasmCall(exports, name, args) = Number(exports[name](...(args || []))) Test fixture tests/codegen-deno/wasm_call.{affine,harness.mjs} exercises the round-trip with a 41-byte hand-built wasm module exporting add(i32, i32) -> i32; all 7 codegen-deno harnesses pass. Closes #414. Updates docs/bindings-roadmap.adoc row #5 status ◐ → ● and points the rationale at this PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
🔍 Hypatia Security ScanFindings: 82 issues detected
View findings[
{
"reason": "Action perpolymath/standards/.github/workflows/governance-reusable.yml@main\n needs attention",
"type": "unpinned_action",
"file": "governance.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action ons/checkout@v6\n needs attention",
"type": "unpinned_action",
"file": "publish-jsr.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action land/setup-deno@v2\n needs attention",
"type": "unpinned_action",
"file": "publish-jsr.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in affine-vscode-publish.yml",
"type": "unknown",
"file": "affine-vscode-publish.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "unknown",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "unknown",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "unknown",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "unknown",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "unknown",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "unknown",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the generic Option A surface from bindings #5: a single extern that lowers to
exports[name](...args)on the --deno-esm backend, with Number coercion so i32/i64/f32/f64 returns all coerce to Float at the AffineScript boundary.This is the smallest-scope / highest-leverage Tier-1 binding item — it unblocks idaptik vm/wasm (740 LoC) and every future WASM-host integration. Typed per-Zig-fn shims can layer on top per-consumer where typing discipline outweighs the generic surface's flexibility.
Surface:
Lowering (lib/codegen_deno.ml):
Test fixture tests/codegen-deno/wasm_call.{affine,harness.mjs} exercises the round-trip with a 41-byte hand-built wasm module exporting add(i32, i32) -> i32; all 7 codegen-deno harnesses pass.
Closes #414. Updates docs/bindings-roadmap.adoc row #5 status ◐ → ● and points the rationale at this PR.