Skip to content

How to specify function wrapper APIs? #82

@tlively

Description

@tlively

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?

cc @rmahdav @jakobkummerow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions