Skip to content

Make strongly-unique hyphen-insensitive - #704

Merged
bvisness merged 2 commits into
WebAssembly:mainfrom
bvisness:no-hyphens
Aug 27, 2026
Merged

Make strongly-unique hyphen-insensitive#704
bvisness merged 2 commits into
WebAssembly:mainfrom
bvisness:no-hyphens

Conversation

@bvisness

Copy link
Copy Markdown
Collaborator

In #197 @lukewagner discussed making the strongly-unique algorithm also hyphen-insensitive. There was also some discussion of how strong this needed to be, but in my opinion it makes the most sense to remove hyphens entirely when checking for uniqueness, as this completely prevents names that differ only in case.

This is already a concern for us in Firefox, as an identifier like [method]a-b.AB on resource type a-b will produce a class named AB (PascalCase), and a method named AB (theoretically camelCase, but acronym). That's maybe workable for us as far as JS goes (because the constructor is just named constructor), but obviously other languages like Java and C# would choke on this case as well. I don't see a good reason for component interfaces to require case sensitivity.

@bvisness
bvisness requested a review from lukewagner August 20, 2026 14:14

@badeend badeend left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this makes sense and offers wider compatibility across different languages 👍

@lukewagner

Copy link
Copy Markdown
Member

Good point! Makes sense to me. It might be good to get a bit of implementation feedback (to see if this breaks anything) before merging though.

@bvisness

Copy link
Copy Markdown
Collaborator Author

Yeah, for sure. I do think this is a direction we want to go but there's no urgency to merge this; we can work around stuff for now (and are unlikely to encounter this in practice).

@alexcrichton

Copy link
Copy Markdown
Collaborator

Implementation-wise this is easy enough. I expect various minor tests to break with this change (e.g. this spec test), but I'd be surprised if this had any broader fallout.

@lukewagner was there any sort of specific implementation feedback you were looking to acquire? My guess is that if this actually breaks anyone we won't actually know until late in deployment when it's practically a bit too late to roll back, but I still think that the chance of that is quite small. Basically, personally, I'd be happy to go ahead and merge the wasm-tools change into Wasmtime and such think it's reasonable to merge the spec PR here.

@lukewagner

Copy link
Copy Markdown
Member

@alexcrichton Good to hear on both counts, thanks! Then agreed to merge now.

@bvisness Do you suppose you could extend the (rather meager atm) strong-uniqueness tests at the end of test/validation/kebab.wast with some cases to check the new rules?

@bvisness

Copy link
Copy Markdown
Collaborator Author

Yes, I can at minimum add all the new examples from the explainer, and maybe others if I think of them.

@alexcrichton

Copy link
Copy Markdown
Collaborator

@bvisness can you double-check that the tests added here are as you intended?

@bvisness

Copy link
Copy Markdown
Collaborator Author

Yeah those look good, and I suggested an extra one as well.

@bvisness

Copy link
Copy Markdown
Collaborator Author

Added. Should I just wait for a wasmtime release before merging this? I assume this is what @alexcrichton is working towards with that wasm-tools update?

@alexcrichton

Copy link
Copy Markdown
Collaborator

Personally I think it's fine to merge this whenever, we haven't historically had a strict policy about exactly when to merge and it's mostly based on vibes. For changes like this which are technically breaking but aren't expected to break anything in practice they've just been merged whenever

@lukewagner lukewagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this is just a restriction (not a new feature) and implementation feedback is in, I think we can merge whenever.

@bvisness
bvisness merged commit 8c8cc81 into WebAssembly:main Aug 27, 2026
1 check passed
@bvisness
bvisness deleted the no-hyphens branch August 27, 2026 17:53
alexcrichton added a commit to alexcrichton/wasm-tools that referenced this pull request Aug 27, 2026
)

* Drop hyphens when testing equality of kebab names

This commit is an implementation of WebAssembly/component-model#704 for
this repository where the main change is to drop the `-` character when
comparing kebab-names. More rationale can be found in the upstream PR,
and while there's expected to be minor amounts of test-related fallout
this is not expected to break anything in practice.

* Add another test
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.

4 participants