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

Clarification regarding value parameter for WebAssembly.Global etc. #1660

Open
manoskouk opened this issue Jun 2, 2023 · 3 comments
Open

Comments

@manoskouk
Copy link

Please confirm if the intended behavior for reference-typed WebAssembly.Global is the following:

  • new WebAssembly.Global({ "value": "anyfunc", "mutable": true}).value == null
  • new WebAssembly.Global({ "value": "anyfunc", "mutable": true}, undefined) throws TypeError
  • new WebAssembly.Global({ "value": "externref", "mutable": true}).value == undefined

and the omitted/undefined value behaves the same for table.new, table.set, table.grow.

@eqrion
Copy link
Contributor

eqrion commented Jun 2, 2023

That is my understanding of WebAssembly.Global behavior. It's implied by the behavior of DefaultValue [1].

The Table JS-API methods also have this behavior as well.

[1] https://webassembly.github.io/spec/js-api/index.html#defaultvalue

@Ms2ger
Copy link
Collaborator

Ms2ger commented Jun 5, 2023

Hmm, as far as I can tell from https://webidl.spec.whatwg.org/#create-an-interface-object , the first two should be equivalent (ORA returns <WebAssembly.Global, [GlobalDescriptor { ... }, "missing"]>), but neither Chrome nor Firefox appears to implement that.

CC @annevk @domenic who might know where I misread.

@annevk
Copy link
Member

annevk commented Jun 5, 2023

Might be further fallout from engines not actually using Web IDL?

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

No branches or pull requests

5 participants
@Ms2ger @annevk @manoskouk @eqrion and others