Skip to content

use for implements interface #768

Open

Description

@chenyan2002

Consider this WIT file, where I want to virtualize response into wrapped-response.

interface types {
  resource request;
}
interface response {
  use types.{request};
  send: func(r: request) -> request;
}

world w {
  import types;
  import response;
  export wrapped-types: types;
  export wrapped-response: response;
}

The implements rename only happen at the surface level: wrapped-response.request still points to the imported types.request, not wrapped-types.request, which means request cannot be virtualized with just implements.

I can manually duplicate the interfaces and rename them, and not using the implements feature. Just wondering if implements is supposed to work with this kind of virtualization use case. If so, maybe we want to extend the syntax to something like export wrapped-response: response with { types: wrapped-types }.

Another limitation is that we can't write use wrapped-types.{request} in WIT, because wrapped-types is a label, so there is no way to refer to the virtualized wrapped-types.{request} by hand either.

Activity

  1. lukewagner commented on Nov 16, 2026

    @lukewagner
    Member

    Thanks for filing! Those use cases makes sense. I think both reflect pre-existing limitations in WIT's ability to express arbitrary CM types and implements is just surfacing them more readily. Specifically:

    • I think your idea for with { types: wrapped-types } mirrors with (modulo syntax) in this comment
    • We need to be able to write use wrapped-types.{request} for any plain-name wrapped-types (regardless of implements); also highlighted here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions