Skip to content

Add support for implements clause#1551

Draft
ricochet wants to merge 1 commit intobytecodealliance:mainfrom
ricochet:implements
Draft

Add support for implements clause#1551
ricochet wants to merge 1 commit intobytecodealliance:mainfrom
ricochet:implements

Conversation

@ricochet
Copy link
Contributor

@ricochet ricochet commented Mar 1, 2026

DO NOT MERGE until wasm-tools release with
bytecodealliance/wasm-tools#2453

The component model implements clause allows a world to import
or export the same interface multiple times under
different plain names.

This threads the new implements:Option<InterfaceId> field from
wit-parser through the WorldGenerator trait
and all backends (Rust, C, C++, C#, Go, MoonBit, Markdown).

A shared wasm_import_module_name helper
produces the [implements=<I>]label binary encoding.

Key per-backend concerns handled:

  • Type dedup: types are generated once per InterfaceId,
    not per label
  • Wasm names: all wasm-level import/export names use the
    implements encoding when applicable
  • Distinct bindings: each label gets its own
    module/namespace with independent function bindings

The component model `implements` clause allows a world to import
or export the same interface multiple times under
different plain names.

This threads the new `implements:Option<InterfaceId>` field from
wit-parser through the `WorldGenerator` trait
and all backends (Rust, C, C++, C#, Go, MoonBit, Markdown).

A shared `wasm_import_module_name` helper
produces the `[implements=<I>]label` binary encoding.

Key per-backend concerns handled:
- Type dedup: types are generated once per InterfaceId,
   not per label
- Wasm names: all wasm-level import/export names use the
  implements encoding when applicable
- Distinct bindings: each label gets its own
   module/namespace with independent function bindings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant