Skip to content

Tighten validation to require uniqueness between import and export kebab-names - #164

Merged
lukewagner merged 1 commit into
mainfrom
unique-imports-and-exports
Feb 27, 2023
Merged

lukewagner merged 1 commit into
mainfrom
unique-imports-and-exports

Conversation

@lukewagner

@lukewagner lukewagner commented Feb 14, 2023 •

Copy link
Copy Markdown
Member

Recently, I've seen a few cases where the possibility of overlap between the kebab-names of imports and exports has led to additional complexity that seems unnecessary given that the whole point of kebab-names is to provide a nice local developer-friendly names that can be renamed in cases of collision without impacting meaning (which is where the (id <URL>) subfield come in instead). Thus, this PR suggests tightening the validation rules for component-level externnames to rule out these cases of overlap. E.g., with this change, the names of imports and exports in a Wit world can share a single namespace.

@alexcrichton alexcrichton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely simplifies the bindings generation side of things, but are there use cases that this might otherwise affect such as "I import and export $FOO" where slightly different names now need to be assigned? Those cases can always continue to work with slight renamings which doesn't sound like the end of the world to me, but I haven't thought too far ahead to those cases myself.

@lukewagner

Copy link
Copy Markdown
Member Author

Ok, async feedback seems positive and no issues raised, so merging.

@lukewagner
lukewagner merged commit b43881a into main Feb 27, 2023
@lukewagner
lukewagner deleted the unique-imports-and-exports branch February 27, 2023 16:51
alexcrichton added a commit to alexcrichton/wasm-tools that referenced this pull request Feb 28, 2023
This commit implements WebAssembly/component-model#164 which moves
component imports and exports into the same namespace as opposed to the
prior disjoint namespaces. This new restriction is then carried through
to WIT parsing as well and all the various tests/resolution.
alexcrichton added a commit to bytecodealliance/wasm-tools that referenced this pull request Feb 28, 2023
This commit implements WebAssembly/component-model#164 which moves
component imports and exports into the same namespace as opposed to the
prior disjoint namespaces. This new restriction is then carried through
to WIT parsing as well and all the various tests/resolution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants