#532: WebAssembly js-types API

Visit on Github.

Opened Jun 30, 2020

Saluton TAG!

I'm requesting a TAG review of the WebAssembly js-types API.

WebAssembly is typed, and its types carry information that can be useful and important to clients interacting with WebAssembly modules and objects through the JS API. For example, types describe the form of imports and exports, including the size limits of memories and tables or the mutability of globals. This proposal adds respective functionality to the WebAssembly JS API in a systematic manner.

Further details:

  • I have reviewed the TAG's API Design Principles
  • The group where the incubation/design work on this is being done (or is intended to be done in the future): WebAssembly CG
  • The group where standardization of this work is intended to be done ("unknown" if not known): WebAssembly WG
  • Existing major pieces of multi-stakeholder review or discussion of this design: not aware of any
  • Major unresolved issues with or opposition to this design: Design of WebAssembly.Function.
  • This work is being funded by: Igalia

We'd prefer the TAG provide feedback as (please delete all but the desired option):

🐛 open issues in our GitHub repo for each point of feedback

Discussions

Discussed Jul 20, 2020 (See Github)

[bumped to next week

Comment by @Ms2ger Sep 16, 2020 (See Github)

Fwiw, Igalia is currently implementing in SpiderMonkey and will likely start on implementing in JSC soon. Feedback soon would be very welcome.

Comment by @kenchris Sep 23, 2020 (See Github)
function print(...args) {
  for (let x of args) console.log(x + "\n")
}

let table = new Table({element: "anyfunc", minimum: 10});

let print_i32 = new WebAssembly.Function({parameters: ["i32"], results: []}, print);
table.set(0, print_i32);
let print_f64 = new WebAssembly.Function({parameters: ["f64"], results: []}, print);
table.set(1, print_f64);
let print_i32_i32 = new WebAssembly.Function({parameters: ["i32", "i32"], results: []}, print);
table.set(2, print_i32_i32);

In the above example where you are exporting a JS function to Wasm, wouldn't it makes sense it I could supply meta data (in the WebAssembly.Function call) that would be given to the print method when run, so that I could change the formatting.

Comment by @hober Sep 23, 2020 (See Github)

This first example seems awfully convoluted. Is there also a higher-level API that does some of this work for you? If we can't improve upon what Emscripten already does for people, why will they bother to switch?

Comment by @kenchris Sep 23, 2020 (See Github)

The WebAssembly.imports() function returns an array containing descriptions of all the declared imports of the given Module.

I found it quite confusing that imports is actually returning a description and not doing any importing.

Discussed May 1, 2021 (See Github)

In exactly the same state as the Raw Sockets API one. Tess pinged ms2ger to see if he'd seen the feedback from September.

Comment by @hober May 12, 2021 (See Github)

@Ms2ger, any thoughts on the observations @kenchris & I made in September?

Discussed Sep 1, 2021 (See Github)

Still waiting for feedback

Comment by @torgo Sep 16, 2021 (See Github)

Hi we are just noting this is still pending feedback from the requestor. @Ms2ger should we close this?

Discussed Sep 20, 2021 (See Github)

plenary

Comment by @hober Dec 7, 2021 (See Github)

Hi @Ms2ger,

We're closing this issue due to the lack of response here & in WebAssembly/js-types#26. If you come back to this project at some point and would like us to revisit, we'd be happy to reopen this, or you could file a new request.

Comment by @Ms2ger Dec 8, 2021 (See Github)

@hober apologies for my lack of availability here - I'm hoping to get back to this next year.