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

NodeJS WASI API throwns an exception when both _start and _initialize are exported #51544

Closed
johanbrandhorst opened this issue Jan 22, 2024 · 3 comments

Comments

@johanbrandhorst
Copy link

johanbrandhorst commented Jan 22, 2024

This isn't an issue so much as opening a discussion surrounding this design choice. What basis was used for the decision to throw an exception if both _start and _initialize are defined? I'm asking as one of the authors of a proposal for Go to support exporting functions to Wasm: golang/go#65199. I'm trying to understand more about the patterns and expectations of the ecosystem. Is there any reason these two can't coexist, and the host can call either depending on the users actions? Thanks!

@johanbrandhorst
Copy link
Author

This restriction appears to have been added in #33073. CC @cjihrig

@guybedford
Copy link
Contributor

Commands and reactors are distinct execution models, so I believe that would have been the intent here. Specifically WASI doesn't define that _initialize is called for commands (which use _start). See https://github.com/WebAssembly/WASI/blob/main/legacy/application-abi.md#current-unstable-abi for more info.

@johanbrandhorst
Copy link
Author

Yep, I think this is fine, I forgot to close this one, but to close the loop, @cjihrig was kind enough to jump in on the Go proposal and explain the rationale. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants