WebAssembly / WebAssembly/custom-descriptors
How to specify function wrapper APIs?
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 12
- Forks
- 3
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 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?
cc @rmahdav @jakobkummerow
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the wrapper examples and the existing discussion in this issue, including the concerns about stack traces, toString(), WebAssembly.Function types, and Binaryen optimizations. Done means reaching an agreed specification for both wrapper APIs and documenting their semantics and constraints; no files or tests are identified in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, wasm
- Domain
- api, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100