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

Compatibility with JS Structs proposal #2

Open
takikawa opened this issue Mar 23, 2022 · 0 comments
Open

Compatibility with JS Structs proposal #2

takikawa opened this issue Mar 23, 2022 · 0 comments

Comments

@takikawa
Copy link
Collaborator

One design issue is that it would be good to aim for compatibility with the JS Structs proposal that is at stage 1 in TC39. It proposes a new "struct" construct for JS that is initialized all at once, and is non-extensible with additional fields (sealed). In the future, it may also have some notion of types (like typed arrays), though likely not in the initial proposal.

The reason for having compatibility is to avoid having two kinds of objects specified in JS that would have very similar features. While the Wasm JS API spec could specify its own kinds of exotic objects to represent customized Wasm GC structs, it would be better if the spec language could effectively say "it's a JS struct" with some additional constraints.

In addition, a main motivation for JS structs is to allow for shared structs that can be shared between threads. In the long-run, when Wasm GC interoperates with the threading proposal, we might have shared GC structs in the language. It would be desirable for these to be reflected as JS shared structs so that they could be shared between JS workers and work with the usual Atomics constructs.

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

1 participant