Skip to content

[Feature] FFI closure direction 2: marshal JS functions into wasm (callback args / nested results) #12

Description

@katsujukou

Summary

A JS function passed into wasm — as a callback argument, or nested inside a foreign's
result — cannot currently be marshalled into a callable wasm closure. Only direction 1 (a
wasm closure handed out to JS) is implemented.

Status / evidence

  • The import-direction marshaller throws explicitly: bin/src/Main.purs:465 —
    "marshalling a JS function into wasm is not yet supported (ADR 0014, closure direction 2)".
  • ADR 0014 defers this: it needs a JS-side function registry + a host-import trampoline so
    wasm can hold and re-enter a JS callable.

Direction

Per ADR 0014: register JS callables and expose a host-import trampoline; have eqrefFromJs
wrap a JS function as a wasm closure that calls back through it.

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions