WebAssembly / esm-integration

ECMAScript module integration
https://webassembly.github.io/esm-integration/js-api/index.html#esm-integration
Other
377 stars 32 forks source link

Examples: why an error in the wasm<->JS cycle case for value exports? #58

Closed takikawa closed 2 years ago

takikawa commented 2 years ago

In the examples document, there is a case for cyclic imports between Wasm and JS where the Wasm module is higher in the graph.

The value import case is shown as an error in the table below:

JS exports

export type value (not a WebAssembly.Global)* global memory table function
Error snapshot snapshot snapshot snapshot

Does this case really need to be an error? Since the JS module is evaluated first, it seems like the value should be available at Wasm import time, and it can call ToWasmValue on this normally to allocate a suitable global.

takikawa commented 2 years ago

Fixed by #59