Instance lookup function for Wasm Namespaces #108
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a PR against the PR in #104 to address the Wasm CG feedback from @rossberg that being able to obtain global handles is still a required use case for runtime reflection on instance phase ESM Integration Wasm modules.
This is an alternative to the original suggestion in #107, coming out of that discussion.
In this approach, we introduce a new
WebAssembly.Instance.namespaceInstance(ns) -> WebAssembly.Instance
API for obtaining theWebAssembly.Instance
runtime instance reflection object for a WebAssembly module imported in the instance phase ESM Integration (import * as ns from './mod.wasm'
).This is useful because where #104 would directly provide global values in Wasm exports, the
Instance
object would provide more features such as having global runtime type introspection per https://github.com/WebAssembly/js-types/blob/main/proposals/js-types/Overview.md, and possibly other features in future.This is something like what was previously discussed as the
instance
phase import form in the import phase discussions, providing instance reflection APIs. So doesn't seem like a major departure from existing semantics. This wouldn't be supporting or advocating a new instance phase, but could also align with it if runtime instance controller reflections for JS became useful in future.