WebAssembly / WebAssembly/component-model

Question: Why is it not possible to refer to exported types in imports?

Open
#272 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
1.4k
Forks
130
Avg merge
2d 1h
Merged PRs (30d)
15

Description

The Component Model does not currently allow you to refer to exported types in imports, which feels asymmetric given that one can easily refer to imported types in exports. This becomes a practical concern when attempting to virtualize interfaces such as wasi:http/incoming-handler, which contains a handle function with parameters which are handles to resources which the guest is importing. The most natural way to virtualize that interface is unfortunately impossible since it would require importing a function with parameters which are handles to resources which the virtualizing component is exporting.

Is there a fundamental reason why this is not possible, e.g. by allowing a component to declare a type, refer to it in an import, and later export it?

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start with the Component Model specification rules for imports, exports, and type declarations, then trace the wasi:http/incoming-handler interface and its handle signature. Done would require a documented design decision explaining whether exported types can be referenced by imports and, if so, the required model changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.