Should type imports be restricted to defined types and resources

Open
#769 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
wasm
Domain
compilers

Research direction

Read the issue's component text examples and the tests added in wasm-tools PR 2833. Decide whether imports of instance, component, and function types should be allowed, and clarify the intended rules for type imports, including the exported-type example. Done means the specification has a clear decision and corresponding behavior is agreed upon.

Written by the indexing model from the issue text.

Description

It turns out that wasmparser as a slew of minor issues related to handling type imports of instance, component, and function types. For example:

(component 
    (type $f (func))
    (import "f" (type (eq $f)))
)

One example is that wasmparser rejects, likely erroneously, this currently:

(component
  (type $f (func))
  (export "f" (type $f))
  (import "g" (type (eq $f)))
)

Another example is tests added in https://github.com/bytecodealliance/wasm-tools/pull/2833 as well.

Overall I'm not aware of an actual use case of this. Resources make sense, and defined types make sense for bindings generation, but I'm not sure importing other kinds of types has much of a use case beyond "let's fill out the full matrix". I wanted to raise this as a very-not-urgent issue as a result in case others had thoughts on this.

Dominant language
WebAssembly
Stars
1.4k
Forks
134
Avg merge
3d 19h
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WebAssembly/component-model

All issues in WebAssembly/component-model

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.