Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to new JavaScript-Promise Integration API #8

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vouillon
Copy link

No description provided.

@github-iron github-iron added the forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system. label Sep 19, 2024
@rickyvetter
Copy link

When I tried this I get an error in node v23.0.0-v8-canary2024100880fe21ab46:

RuntimeError: attempting to suspend without a WebAssembly.promising export

Reading https://github.com/WebAssembly/js-promise-integration/blob/main/proposals/js-promise-integration/Overview.md, I think there is more work required. We need to implement the promising part of the pair, which is awkward because I don't think there is current machinery for inserting JavaScript code into the runtime which has access to some corresponding wasm export values.

Did you run into this error? Which version of node were you running against if not?

@vouillon
Copy link
Author

vouillon commented Oct 9, 2024

I think you need ocaml-wasm/wasm_of_ocaml#48 as well.
I have tested with an older version of node, v23.0.0-v8-canary2024070398c15bef2c, which supports both APIs.

@rickyvetter
Copy link

Ahh yes. With ocaml-wasm/wasm_of_ocaml#48 this does look good!

@rickyvetter
Copy link

I've noticed that I do get an error when running with whole program compilation and aggressive wasm-metadce passes on tests that don't use effects. I can resolve by editing https://github.com/ocaml-wasm/wasm_of_ocaml/blob/main/runtime/wasm/deps.json#L4 to include "effects", which I think is the correct fix? It might make more sense to try and generate deps.json somehow?

@vouillon
Copy link
Author

Actually, we don't need caml_start_fiber for tests that don't use effects. The issue is that make_promising is failing when passed an undefined value. I have pushed a fix to ocaml-wasm/wasm_of_ocaml#48.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants