WebAssembly / WebAssembly/component-model

Allow exporting types directly worlds without interface

Open
#426 1 comment 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

Components are also able to directly export types, so it is just a temporary WIT limitation that you're not able to define and export the math-class enum directly in the world. We should probably fix that to avoid this question.

In the meantime, you can also write:

world w {
  export types: interface {
    enum math-class { ... }
  }
}

Originally posted by @lukewagner in https://github.com/WebAssembly/component-model/issues/295#issuecomment-1904839659

The ideal is to somehow have the math-class enum on the root world instead of nested inside a redundant interface name. Unsure if you still want to pursue this.

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 by reading the WIT examples in this issue and the referenced discussion in issue 295, then review how the component model handles exported types from worlds and interfaces. The change is complete when the intended root-world type export is specified clearly and the redundant interface form is no longer required, with the desired behavior documented or covered by the project’s existing validation path.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.