Stream: wasi

Topic: Multiple interface imports


view this post on Zulip Scott Andrews (Jul 25 2024 at 21:14):

Is there a way to import the same interface more than once in a single world? WIT doesn't seem to support external references that change the name of an imported/exported interface. Importing the same interface twice creates a name conflict.

I want to have a world like:

world merge-environments {
    import wasi:cli/environment@0.2.0;
    import wasi:cli/environment@0.2.0 as overlay;
    export wasi:cli/environment@0.2.0;
}

As a work around, I can redefine the interface under a different name. The closest I can get today is:

world merge-environments {
    import wasi:cli/environment@0.2.0;
    import overlay: interface  {
        get-environment: func() -> list<tuple<string, string>>;
    }
    export wasi:cli/environment@0.2.0;
}

view this post on Zulip Alex Crichton (Jul 25 2024 at 21:25):

Currently this isn't possible, it requires the workaround you've outlined. Others have expressed interest for this feature however but I can't seem to find the issue in the upstream component-model repo right now

view this post on Zulip Scott Andrews (Jul 25 2024 at 21:26):

Thanks for the confirmation


Last updated: Dec 23 2024 at 13:07 UTC