Skip to content

Commit 5b78168

Browse files
authored
Re-add case-insensitive uniqueness (#337)
* Re-add case-insensitive uniqueness * Update uniquness criteria in WIT.md too
1 parent 4bafd01 commit 5b78168

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

design/mvp/Binary.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ Notes:
251251
* All parameter labels, result labels, record field labels, variant case
252252
labels, flag labels, enum case labels, component import names, component
253253
export names, instance import names and instance export names must be
254-
unique in their containing scope.
254+
unique in their containing scope, considering two labels that differ only in
255+
case to be equal and thus rejected.
255256
* Validation of `externdesc` requires the various `typeidx` type constructors
256257
to match the preceding `sort`.
257258
* (The `0x00` immediate of `case` may be reinterpreted in the future as the

design/mvp/Explainer.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,12 @@ mapped to `isXML`, `IsXml`, `is_XML` or `is_xml`, depending on the target
15621562
language/convention. The highly-restricted character set ensures that
15631563
capitalization is trivial and does not require consulting Unicode tables.
15641564

1565+
Because some casing schemes (such as all-lowercase) would lead to clashes if
1566+
two `label`s differed only in case, in all cases where "uniquness" is required
1567+
between a set of names (viz., import/export names, record field labels, variant
1568+
case labels, and function parameter/result names), two `label`s that differ
1569+
only in case are considered equal and thus rejected.
1570+
15651571
Components provide two options for naming exports, symmetric to the first two
15661572
options for naming imports:
15671573
* a **plain name** that leaves it up to the developer to "read the docs"

design/mvp/WIT.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,10 @@ world command {
234234
}
235235
```
236236

237-
Kebab names cannot overlap and must be unique, even between imports and exports.
238-
IDs, however, can be both imported and exported. The same interface cannot be
239-
explicitly imported or exported twice.
237+
Each name must be case-insensitively unique in the scope in which it is
238+
declared. In the case of worlds, all imported names are in the same scope,
239+
but separate from all the export names, and thus the same name can *not* be
240+
imported twice, but *can* be both imported and exported.
240241

241242
[Plain Name]: Explainer.md#import-and-export-definitions
242243

@@ -647,7 +648,7 @@ import unless it's explicitly listed as an export.
647648

648649
Functions are defined in an [`interface`][interfaces] or are listed as an
649650
`import` or `export` from a [`world`][worlds]. Parameters to a function must all
650-
be named and have unique names:
651+
be named and have case-insensitively unique names:
651652

652653
```wit
653654
package local:demo;

0 commit comments

Comments
 (0)