You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider re-allowing import/export kebab-names to overlap #252
Earlier, we tightened the rules for import/export names to disallow them from having the same name. The motivation was to avoid requiring bindings generators to have to conservatively group imports and exports into separate namespaces and also to allow the body of a world to refer to either an import or export with a simple identifier without the need to qualify "import" or "export".
Since then, however, a few things have developed that suggest revisiting this restriction:
From what I've seen of bindings generators, import and export names end up being put in separate namespaces anyways.
We're using use to project resource types from imported interface, not dotted id.foo projections.
We split import/export names into bare kebab-names and interface ids and, because we have clear use cases for it, we allow the same interface id to be imported and exported.
Thus, it's both a bit irregular not to be able to import/export the same kebab-name and also it doesn't seem to be buying us much in practice (afaik, but happy to hear otherwise). Thus, I think it makes sense to ask whether we should remove this restriction for kebab-names (so that kebab-name rules matched interface id rules).
@esoterra hit this restriction organically while working on his WasmCon demo, and, at least in that context, the restriction does feel artificial and credit to Kyle for raising the question.
To elaborate on the use case, I needed a simple proxy world that imported and exported a greet function. The interfaces and source code implementations for the demo are available in a GitHub repo.
While this specific use case is quite trivial, I expect I'm not the only person who will want to make simple proxy components and it's pretty surprising and frustrating to have to add extra indirection through an interface to get around this rule.
To provide more support for the first point Luke made, each of the different example components distinguished the names or namespaces of imports and exports anyway. Here's a quick overview of what that looked like for each of the four languages.
Activity
esoterra commentedon Sep 22, 2023
To elaborate on the use case, I needed a simple proxy world that imported and exported a
greetfunction. The interfaces and source code implementations for the demo are available in a GitHub repo.While this specific use case is quite trivial, I expect I'm not the only person who will want to make simple proxy components and it's pretty surprising and frustrating to have to add extra indirection through an interface to get around this rule.
To provide more support for the first point Luke made, each of the different example components distinguished the names or namespaces of imports and exports anyway. Here's a quick overview of what that looked like for each of the four languages.
wasmcon2023_greet_interface_greetexports_wasmcon2023_greet_interface_greetbindings::wasmcon2023::greet::interface::greet()impl Guest for Component(including definition ofgreet())import { greet } from 'wasmcon2023:greet/interface';export { greetInterface as 'interface' }from proxy_greeter.imports import interfaceclass Interface(exports.Interface):Thanks for officially proposing this Luke!
Relax the uniqueness requirements on kebab-names
lukewagner commentedon Sep 27, 2023
Seems like no problems with the change, so I filed #259 to make the change.
Relax the uniqueness requirements on kebab-names (WebAssembly#259)