WebAssembly / component-model

Repository for design and specification of the Component Model
Other
897 stars 75 forks source link

Mistake in WIT Specification? #342

Closed toadslop closed 2 months ago

toadslop commented 2 months ago

Hey all, I was reviewing the WIT specification and I noticed an inconsistency between how a Package Name is described in prose vs how it is specified and I wanted to confirm whether or not this is a mistake.

According to the specification, a package name (declaration?) should follow this pattern:

package-decl        ::= 'package' ( id ':' )+ id ( '/' id )* ('@' valid-semver)?  ';'

From this specification, the following package name should be valid:

package one:two:three:four/five/six/seven;

However, this section specifies a more restricted format:

All WIT packages are assigned a package name. Package names look like foo:bar@1.0.0 and have three fields:

- A namespace field, for example foo in foo:bar. This namespace is intended to disambiguate between registries, top-level organizations, etc. For example WASI interfaces use the wasi namespace.

- A package field, for example clocks in wasi:clocks. A "package" groups together a set of interfaces and worlds that would otherwise be named with a common prefix.

- An optional version field, specified as [full semver](https://semver.org/).

This description suggests that the specification should be:

package-decl        ::= 'package' id ':' id ('@' valid-semver)?  ';'

Could you clarify which is correct? I'll put in a PR for the fix once I get a response.

alexcrichton commented 2 months ago

Ah the format started out as a:b@1.0.0, but it was extended to support a:b/c:d@1.0.0 and I think not necessarily all parts of the spec has caught up yet. This is one of the gated features with the 🪺 emoji. Regardless it'd still be good to update!

lukewagner commented 2 months ago

Thanks, good catch; I'll update the prose to match the grammar (gated by 🪺).

lukewagner commented 2 months ago

Added here

toadslop commented 2 months ago

Thanks guys! I was wondering about that.