`use` for `implements` interface

Open
#768 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
12/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
wasm
Domain
api

Research direction

The reproduction is the WIT example in the issue: an implements rename of response leaves wrapped-response.request pointing at the imported types.request instead of wrapped-types.request. Start by working out whether the spec defines implements to rewrite use-referenced types, and by checking the component-model specification text on use and implements. Done means a maintainer decision on the intended semantics, and possibly a proposed syntax such as with { types: wrapped-types }. This is spec design work, not a first-time code change.

Written by the indexing model from the issue text.

Description

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.

Dominant language
WebAssembly
Stars
1.4k
Forks
134
Avg merge
3d 19h
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from WebAssembly/component-model

All issues in WebAssembly/component-model

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.