-
Notifications
You must be signed in to change notification settings - Fork 1
Description
As we've discussed at various points, we still need to spec two APIs for wrapping WebAssembly functions: one for allowing the functions to be called with new and another to pass the receiver as the first parameter. These functions should be similar to these wrappers you can write today:
function callableWithNew(f) {
return function(...args) {
return f(...args);
)
)function withReceiver(f) {
return function(...args) {
return f(this, ...args);
)
)However, we would prefer not to have to materialize these wrappers in stack traces or fake making their bodies available via toString(), etc., which suggests these should not be normal JS functions. But we also don't want them to be WebAssembly.Function instances with the associated Wasm types and linking semantics because that would inhibit the optimizations Binaryen can do to the types of functions that can be passed to configureAll.
How can these best be specified?