`use` for `implements` interface

未关闭
#768 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
12/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
wasm
领域
api

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
WebAssembly
星标
1.4k
派生
134
平均合并
3 天 19 小时
30 天内合并 PR
8

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

WebAssembly/component-model 的其他 Issue

查看 WebAssembly/component-model 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。