diff --git a/design/mvp/Binary.md b/design/mvp/Binary.md index b8966e0d..7c561daf 100644 --- a/design/mvp/Binary.md +++ b/design/mvp/Binary.md @@ -12,7 +12,8 @@ rules, but rather merge the minimal need-to-know elements of both, with just enough detail to create a prototype. A complete definition of the binary format and validation will be present in the [formal specification](../../spec/). -See [Gated Features](Explainer.md#gated-features) for an explanation of ๐Ÿช™ and ๐Ÿ”ง. +See [Gated Features](Explainer.md#gated-features) for an explanation of emoji +annotations like ๐Ÿช™ and ๐Ÿ”ง. ## Component Definitions @@ -371,10 +372,13 @@ flags are set. (See [Import and Export Definitions](Explainer.md#import-and-export-definitions) in the explainer.) ```ebnf -import ::= in: ed: => (import in ed) -export ::= en: si: ed?:? => (export en si ed?) -importname' ::= 0x00 len: in: => in (if len = |in|) -exportname' ::= 0x00 len: en: => en (if len = |en|) +import ::= in: ed: => (import in ed) +export ::= en: si: ed?:? => (export en si ed?) +importname' ::= 0x00 len: in: => in (if len = |in|) + | 0x01 len: in: vs: => in vs (if len = |in|) ๐Ÿ”— +exportname' ::= 0x00 len: en: => en (if len = |en|) + | 0x01 len: en: vs: => in vs (if len = |in|) ๐Ÿ”— +versionsuffix' ::= len: vs: => (versionsuffix vs) (if len = |vs|) ๐Ÿ”— ``` Notes: @@ -399,7 +403,11 @@ Notes: `(result (own $R))`, where `$R` is the resource labeled `r`. * Validation of `[method]` names requires the first parameter of the function to be `(param "self" (borrow $R))`, where `$R` is the resource labeled `r`. -* `` is as defined by [https://semver.org](https://semver.org/) +* ๐Ÿ”— Validation requires that `versionsuffix` is preceded by an `interfaceversion` + matching `canonversion` and that the concatenation of the `canonversion` and + the `versionsuffix` results in a `valid semver` as defined by + [https://semver.org](https://semver.org/). A `versionsuffix` is otherwise + ignored for validation except to improve diagnostic messages. * `` is as defined by the [SRI](https://www.w3.org/TR/SRI/#dfn-integrity-metadata) spec. @@ -494,7 +502,9 @@ named once. * The opcodes (for types, canon built-ins, etc) should be re-sorted * The two `list` type codes should be merged into one with an optional immediate. -* The `0x00` prefix byte of `importname'` and `exportname'` will be removed or repurposed. +* The `0x00` variant of `importname'` and `exportname'` will be removed. Any + remaining variant(s) will be renumbered or the prefix byte will be removed or + repurposed. [`core:byte`]: https://webassembly.github.io/spec/core/binary/values.html#binary-byte diff --git a/design/mvp/Explainer.md b/design/mvp/Explainer.md index 51f30def..49901c55 100644 --- a/design/mvp/Explainer.md +++ b/design/mvp/Explainer.md @@ -33,6 +33,7 @@ more user-focused explanation, take a look at the * [Start definitions](#-start-definitions) * [Import and export definitions](#import-and-export-definitions) * [Name uniqueness](#name-uniqueness) + * [Canonical interface name](#-canonical-interface-name) * [Component invariants](#component-invariants) * [JavaScript embedding](#JavaScript-embedding) * [JS API](#JS-API) @@ -55,6 +56,7 @@ implemented, considered stable and included in a future milestone: * ๐Ÿงต: threading built-ins * ๐Ÿ”ง: fixed-length lists * ๐Ÿ“: the `error-context` type +* ๐Ÿ”—: canonical interface names (Based on the previous [scoping and layering] proposal to the WebAssembly CG, this repo merges and supersedes the [module-linking] and [interface-types] @@ -294,7 +296,8 @@ sort ::= core | type | component | instance -inlineexport ::= (export ) +inlineexport ::= (export "" ) + | (export "" ) ๐Ÿ”— ``` Because component-level function, type and instance definitions are different than core-level function, type and instance definitions, they are put into @@ -574,8 +577,10 @@ instancedecl ::= core-prefix() | | | ๐Ÿช™ -importdecl ::= (import bind-id()) -exportdecl ::= (export bind-id()) +importdecl ::= (import "" bind-id()) + | (import "" bind-id()) ๐Ÿ”— +exportdecl ::= (export "" bind-id()) + | (export "" bind-id()) ๐Ÿ”— externdesc ::= ( (type ) ) | core-prefix() | @@ -988,6 +993,10 @@ and `$C1` is a subtype of `$C2`: ) ``` +๐Ÿ”— Note that [canonical interface names](#-canonical-interface-name) may be +annotated with a `versionsuffix` which is ignored for type checking except to +improve diagnostic messages. + When we next consider type imports and exports, there are two distinct subcases of `typebound` to consider: `eq` and `sub`. @@ -2242,8 +2251,11 @@ the identifier `$x`). In the case of exports, the `?` right after the preceding definition being exported (e.g., `(export $x "x" (func $f))` binds a new identifier `$x`). ```ebnf -import ::= (import "" bind-id()) -export ::= (export ? "" ?) +import ::= (import "" bind-id()) + | (import "" bind-id()) ๐Ÿ”— +export ::= (export ? "" ?) + | (export ? "" ?) ๐Ÿ”— +versionsuffix ::= (versionsuffix "") ๐Ÿ”— ``` All import names are required to be [strongly-unique]. Separately, all export names are also required to be [strongly-unique]. The rest of the grammar for @@ -2257,47 +2269,53 @@ interpreted as a *lexical* grammar defining a single token and thus whitespace is not automatically inserted, all terminals are single-quoted, and everything unquoted is a meta-character. ```ebnf -exportname ::= - | -importname ::= - | - | - | -plainname ::=