Add support for implements clause#1551
Add support for implements clause#1551ricochet wants to merge 1 commit intobytecodealliance:mainfrom
implements clause#1551Conversation
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 guest side of things I think is going to be tricky in its own right compared to the host side of things. Notably if an interface is imported twice this'll need to generate two different types for all types contained within the interface. Without that it's not a reflection of the original WIT itself, so this means that (at least from my understanding at a skim) the duplicate-related handling will need to be removed. To handle this though what I'd recommend is updating the |
DO NOT MERGE until wasm-tools release with
bytecodealliance/wasm-tools#2453
The component model
implementsclause allows a world to importor export the same interface multiple times under
different plain names.
This threads the new
implements:Option<InterfaceId>field fromwit-parser through the
WorldGeneratortraitand all backends (Rust, C, C++, C#, Go, MoonBit, Markdown).
A shared
wasm_import_module_namehelperproduces the
[implements=<I>]labelbinary encoding.Key per-backend concerns handled:
not per label
implements encoding when applicable
module/namespace with independent function bindings