Skip to content

Commit ca2ab99

Browse files
committed
Tighten validation to require uniqueness between import and export kebab-names
1 parent c0ee0ce commit ca2ab99

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

design/mvp/Binary.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,12 @@ Notes:
343343
(which disallows core sorts other than `core module`). When the optional
344344
`externdesc` immediate is present, validation requires it to be a supertype
345345
of the inferred `externdesc` of the `sortidx`.
346-
* The `name` fields of `externname` must be unique among imports and exports,
347-
respectively. The `URL` fields of `externname` (that are present) must
348-
independently unique among imports and exports, respectively.
346+
* The `name` fields of `externname` must be unique among all imports and exports
347+
in the containing component definition, component type or instance type. (An
348+
import and export cannot use the same `name`.)
349+
* The `id` fields of `externname` (that are present) must independently be
350+
unique among imports and exports, respectively. (An import and export *may*
351+
have the same `id`.)
349352
* URLs are compared for equality by plain byte identity.
350353

351354
## Name Section

design/mvp/Explainer.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,9 +1348,13 @@ subdivision of external names allows component producers to represent a variety
13481348
of intentions for how a component is to be instantiated and executed so that a
13491349
variety of hosts can portably execute the component.
13501350

1351-
The `name` field of `externname` is required to be unique. Thus, a single
1352-
`name` has been used in the preceding definitions of `with` and `alias` to
1353-
uniquely identify imports and exports.
1351+
The `name` field of `externname` is required to be unique between all the imports
1352+
and exports of a component definition, component type or instance type. Thus, a
1353+
single `name` can be used to unambiguously select any import or export. Based on
1354+
this, `with` and `alias` can use a `name` (not `externname`) to select an
1355+
import or export. The uniqueness between imports and exports ensures that Wit
1356+
and language bindings don't have to worry about separately namespacing imports
1357+
and exports.
13541358

13551359
In guest source-code bindings, the `name` is meant to be translated to
13561360
source-language identifiers (applying case-conversion, as described

0 commit comments

Comments
 (0)