@@ -87,7 +87,7 @@ sort ::= 0x00 cs:<core:sort> => co
8787 | 0x03 => type
8888 | 0x04 => component
8989 | 0x05 => instance
90- inlineexport ::= n:<exportname' > si:<sortidx> => (export n si)
90+ inlineexport ::= na:<nameattributes > si:<sortidx> => (export na si)
9191```
9292Notes:
9393* Reused Core binary rules: [ ` core:name ` ] , (variable-length encoded) [ ` core:u32 ` ]
@@ -101,8 +101,8 @@ Notes:
101101 for aliases (below).
102102* Validation of ` core:instantiatearg ` initially only allows the ` instance `
103103 sort, but would be extended to accept other sorts as core wasm is extended.
104- * Validation of ` instantiate ` requires each ` <importname > ` in ` c ` to match a
105- ` name ` in a ` with ` argument (compared as strings ) and for the types to
104+ * Validation of ` instantiate ` requires each ` <externname > ` in ` c ` to match a
105+ ` name ` in a ` with ` argument (using plain string equality ) and for the types to
106106 match.
107107* When validating ` instantiate ` , after each individual type-import is supplied
108108 via ` with ` , the actual type supplied is immediately substituted for all uses
@@ -200,18 +200,18 @@ defvaltype ::= pvt:<primvaltype> => pvt
200200 | 0x70 t:<valtype> => (list t)
201201 | 0x67 t:<valtype> len:<u32> => (list t len) (if len > 0) 🔧
202202 | 0x6f t*:vec(<valtype>) => (tuple t+) (if |t*| > 0)
203- | 0x6e l*:vec(<label'>) => (flags l+) (if 0 < |l*| <= 32)
204- | 0x6d l*:vec(<label'>) => (enum l+) (if |l*| > 0)
203+ | 0x6e l*:vec(<labelname>) => (flags l+) (if 0 < |l*| <= 32)
204+ | 0x6d l*:vec(<labelname>) => (enum l+) (if |l*| > 0)
205205 | 0x6b t:<valtype> => (option t)
206206 | 0x6a t?:<valtype>? u?:<valtype>? => (result t? (error u)?)
207207 | 0x69 i:<typeidx> => (own i)
208208 | 0x68 i:<typeidx> => (borrow i)
209209 | 0x66 t?:<valtype>? => (stream t?) 🔀
210210 | 0x65 t?:<valtype>? => (future t?) 🔀
211211 | 0x63 k:<valtype> v:<valtype> => (map k v) (if k is in <keytype>) 🗺️
212- labelvaltype ::= l:<label' > t:<valtype> => l t
213- case ::= l:<label' > t?:<valtype>? 0x00 => (case l t?)
214- label' ::= len:<u32> l:<label> => l (if len = |l|)
212+ labelvaltype ::= l:<labelname > t:<valtype> => l t
213+ case ::= l:<labelname > t?:<valtype>? 0x00 => (case l t?)
214+ labelname ::= len:<u32> l:<label> => "l" (if len = |l|)
215215<T>? ::= 0x00 =>
216216 | 0x01 t:<T> => t
217217valtype ::= i:<typeidx> => i
@@ -230,8 +230,8 @@ instancedecl ::= 0x00 t:<core:type> => t
230230 | 0x01 t:<type> => t
231231 | 0x02 a:<alias> => a
232232 | 0x04 ed:<exportdecl> => ed
233- importdecl ::= in:<importname' > ed:<externdesc> => (import in ed)
234- exportdecl ::= en:<exportname' > ed:<externdesc> => (export en ed)
233+ importdecl ::= na:<nameattributes > ed:<externdesc> => (import na ed)
234+ exportdecl ::= na:<nameattributes > ed:<externdesc> => (export na ed)
235235externdesc ::= 0x00 0x11 i:<core:typeidx> => (core module (type i))
236236 | 0x01 i:<typeidx> => (func (type i))
237237 | 0x02 b:<valuebound> => (value b) 🪙
@@ -273,8 +273,10 @@ Notes:
273273 index spaces. (Note: * subsequent* aliases can introduce new type indices
274274 equivalent to this fresh type.)
275275* Validation rejects ` resourcetype ` type definitions inside ` componenttype ` and
276- ` instancettype ` . Thus, handle types inside a ` componenttype ` can only refer
276+ ` instancetype ` . Thus, handle types inside a ` componenttype ` can only refer
277277 to resource types that are imported or exported.
278+ * ` <label> ` is defined as part of the
279+ [ text format] ( Explainer.md#import-and-export-definitions ) .
278280* All parameter labels, result labels, record field labels, variant case
279281 labels, flag labels, enum case labels, component import names, component
280282 export names, instance import names and instance export names must be
@@ -392,16 +394,14 @@ flags are set.
392394(See [ Import and Export Definitions] ( Explainer.md#import-and-export-definitions )
393395in the explainer.)
394396``` ebnf
395- import ::= in:<importname'> ed:<externdesc> => (import in ed)
396- export ::= en:<exportname'> si:<sortidx> ed?:<externdesc>? => (export en si ed?)
397- importname' ::= 0x00 len:<u32> in:<importname> => in (if len = |in|)
398- | 0x01 len:<u32> in:<importname> => in (if len = |in|)
399- | 0x02 len:<u32> in:<importname> opts:vec(<nameopt>) => in opts (if len = |in|) 🏷️/🔗
400- exportname' ::= 0x00 len:<u32> in:<exportname> => in (if len = |in|)
401- | 0x01 len:<u32> in:<exportname> => in (if len = |in|)
402- | 0x02 len:<u32> in:<importname> opts:vec(<nameopt>) => in opts (if len = |in|) 🏷️/🔗
403- nameopt ::= 0x00 len:<u32> n:<interfacename> => (implements i) 🏷️
404- | 0x01 len:<u32> vs:<semversuffix> => (versionsuffix vs) 🔗
397+ import ::= na:<nameattributes> ed:<externdesc> => (import na ed)
398+ export ::= na:<nameattributes> si:<sortidx> ed?:<externdesc>? => (export na si ed?)
399+ nameattributes ::= 0x00 len:<u32> en:<externname> => "en" (if len = |en|)
400+ | 0x01 len:<u32> en:<externname> => "en" (if len = |en|)
401+ | 0x02 len:<u32> en:<externname> a*:vec(<attribute>) => "en" a* (if len = |en|) 🏷️/🔗
402+ attribute ::= 0x00 len:<u32> in:<interfacename> => (implements "in") (if len = |in|) 🏷️
403+ | 0x01 len:<u32> vs:<semversuffix> => (versionsuffix "vs") (if len = |vs|) 🔗
404+ | 0x02 n:<name> => (external-id n) 🏷️
405405```
406406
407407Notes:
@@ -413,21 +413,26 @@ Notes:
413413 (which disallows core sorts other than ` core module ` ). When the optional
414414 ` externdesc ` immediate is present, validation requires it to be a supertype
415415 of the inferred ` externdesc ` of the ` sortidx ` .
416- * ` <importname> ` and ` <exportname> ` refer to the productions defined in the
417- [ text format] ( Explainer.md#import-and-export-definitions ) .
418- * ` <importname'> ` and ` <exportname'> ` will [ be cleaned up for a 1.0
419- release] ( ##binary-format-warts-to-fix-in-a-10-release ) .
420- * The ` <importname> ` s of a component must all be [ strongly-unique] . Separately,
421- the ` <exportname> ` s of a component must also all be [ strongly-unique] .
416+ * ` <externname> ` , ` <interfacename> ` and ` <semversuffix> ` are defined as part of
417+ the [ text format] ( Explainer.md#import-and-export-definitions ) .
418+ * The redundant ` 0x00 ` /` 0x01 ` cases of ` nameattributes ` will
419+ [ be cleaned up for a 1.0 release] ( #binary-format-warts-to-fix-in-a-10-release ) .
420+ * The ` externname ` s of all imports in a given component or component-type must
421+ be [ strongly-unique] ; attributes are ignored.
422+ * The ` externname ` s of all exports in a given component, instance, component-
423+ type or instance-type must be [ strongly-unique] ; attributes are ignored.
422424* Validation requires that ` [constructor] ` , ` [method] ` and ` [static] ` annotated
423425 ` plainname ` s only occur on ` func ` imports or exports and that the first label
424426 of a ` [constructor] ` , ` [method] ` or ` [static] ` matches the ` plainname ` of a
425427 preceding ` resource ` import or export, respectively, in the same scope
426428 (component, component type or instance type).
427429* 🏷️ Validation requires that ` implements ` -annotated imports or exports are
428- ` instance ` -typed.
429- * 🏷️ Validation requires that ` implements ` -annotated imports or exports have a
430- ` <plainname> ` name.
430+ ` instance ` -typed and have a ` plainname ` name.
431+ * 🏷️/🔗 Validation requires that a ` vec(<attribute>) ` contains each kind of
432+ ` attribute ` at most once.
433+ * 🏷️/🔗 Even though ` componenttype ` and ` instancetype ` structurally contain a
434+ ` vec(<attribute>) ` , this list is entirely ignored when validating the types
435+ of components and instances.
431436* Validation of ` [constructor] ` names requires a ` func ` type whose result type
432437 is either ` (own $R) ` or ` (result (own $R) E?) ` where ` $R ` is a resource type
433438 labeled ` r ` .
@@ -438,8 +443,6 @@ Notes:
438443 the ` versionsuffix ` results in a ` valid semver ` as defined by
439444 [ https://semver.org ] ( https://semver.org/ ) . A ` versionsuffix ` is otherwise
440445 ignored for validation except to improve diagnostic messages.
441- * ` <integrity-metadata> ` is as defined by the
442- [ SRI] ( https://www.w3.org/TR/SRI/#dfn-integrity-metadata ) spec.
443446
444447## 🪙 Value Definitions
445448
@@ -531,12 +534,9 @@ named once.
531534## Binary Format Warts to Fix in a 1.0 Release
532535
533536* The opcodes (for types, canon built-ins, etc) should be re-sorted
534- * The two ` depname ` cases should be merged into one (` dep=<...> ` )
535537* The two ` list ` type codes should be merged into one with an optional immediate
536538 and similarly for ` func ` .
537- * The ` 0x00 ` and ` 0x01 ` variant of ` importname' ` and ` exportname' ` will be
538- removed. Any remaining variant(s) will be renumbered or the prefix byte will
539- be removed or repurposed.
539+ * The redundant ` 0x00 ` and ` 0x01 ` opcodes of ` nameattributes ` will be merged.
540540* Most built-ins should have a ` <canonopt>* ` immediate instead of an ad hoc
541541 subset of ` canonopt ` s.
542542* Add optional ` shared ` immediate to all canonical definitions (explicitly or
0 commit comments