@@ -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
@@ -201,18 +201,18 @@ defvaltype ::= pvt:<primvaltype> => pvt
201201 | 0x70 t:<valtype> => (list t)
202202 | 0x67 t:<valtype> len:<u32> => (list t len) (if len > 0) 🔧
203203 | 0x6f t*:vec(<valtype>) => (tuple t+) (if |t*| > 0)
204- | 0x6e l*:vec(<label'>) => (flags l+) (if 0 < |l*| <= 32)
205- | 0x6d l*:vec(<label'>) => (enum l+) (if |l*| > 0)
204+ | 0x6e l*:vec(<labelname>) => (flags l+) (if 0 < |l*| <= 32)
205+ | 0x6d l*:vec(<labelname>) => (enum l+) (if |l*| > 0)
206206 | 0x6b t:<valtype> => (option t)
207207 | 0x6a t?:<valtype>? u?:<valtype>? => (result t? (error u)?)
208208 | 0x69 i:<typeidx> => (own i)
209209 | 0x68 i:<typeidx> => (borrow i)
210210 | 0x66 t?:<valtype>? => (stream t?) 🔀
211211 | 0x65 t?:<valtype>? => (future t?) 🔀
212212 | 0x63 k:<valtype> v:<valtype> => (map k v) (if k is in <keytype>) 🗺️
213- labelvaltype ::= l:<label' > t:<valtype> => l t
214- case ::= l:<label' > t?:<valtype>? 0x00 => (case l t?)
215- label' ::= len:<u32> l:<label> => l (if len = |l|)
213+ labelvaltype ::= l:<labelname > t:<valtype> => l t
214+ case ::= l:<labelname > t?:<valtype>? 0x00 => (case l t?)
215+ labelname ::= len:<u32> l:<label> => "l" (if len = |l|)
216216<T>? ::= 0x00 =>
217217 | 0x01 t:<T> => t
218218valtype ::= i:<typeidx> => i
@@ -231,8 +231,8 @@ instancedecl ::= 0x00 t:<core:type> => t
231231 | 0x01 t:<type> => t
232232 | 0x02 a:<alias> => a
233233 | 0x04 ed:<exportdecl> => ed
234- importdecl ::= in:<importname' > ed:<externdesc> => (import in ed)
235- exportdecl ::= en:<exportname' > ed:<externdesc> => (export en ed)
234+ importdecl ::= na:<nameattributes > ed:<externdesc> => (import na ed)
235+ exportdecl ::= na:<nameattributes > ed:<externdesc> => (export na ed)
236236externdesc ::= 0x00 0x11 i:<core:typeidx> => (core module (type i))
237237 | 0x01 i:<typeidx> => (func (type i))
238238 | 0x02 b:<valuebound> => (value b) 🪙
@@ -272,8 +272,10 @@ Notes:
272272 index spaces. (Note: * subsequent* aliases can introduce new type indices
273273 equivalent to this fresh type.)
274274* Validation rejects ` resourcetype ` type definitions inside ` componenttype ` and
275- ` instancettype ` . Thus, handle types inside a ` componenttype ` can only refer
275+ ` instancetype ` . Thus, handle types inside a ` componenttype ` can only refer
276276 to resource types that are imported or exported.
277+ * ` <label> ` is defined as part of the
278+ [ text format] ( Explainer.md#import-and-export-definitions ) .
277279* All parameter labels, result labels, record field labels, variant case
278280 labels, flag labels, enum case labels, component import names, component
279281 export names, instance import names and instance export names must be
@@ -389,16 +391,14 @@ flags are set.
389391(See [ Import and Export Definitions] ( Explainer.md#import-and-export-definitions )
390392in the explainer.)
391393``` ebnf
392- import ::= in:<importname'> ed:<externdesc> => (import in ed)
393- export ::= en:<exportname'> si:<sortidx> ed?:<externdesc>? => (export en si ed?)
394- importname' ::= 0x00 len:<u32> in:<importname> => in (if len = |in|)
395- | 0x01 len:<u32> in:<importname> => in (if len = |in|)
396- | 0x02 len:<u32> in:<importname> opts:vec(<nameopt>) => in opts (if len = |in|) 🏷️/🔗
397- exportname' ::= 0x00 len:<u32> in:<exportname> => in (if len = |in|)
398- | 0x01 len:<u32> in:<exportname> => in (if len = |in|)
399- | 0x02 len:<u32> in:<importname> opts:vec(<nameopt>) => in opts (if len = |in|) 🏷️/🔗
400- nameopt ::= 0x00 len:<u32> n:<interfacename> => (implements i) 🏷️
401- | 0x01 len:<u32> vs:<semversuffix> => (versionsuffix vs) 🔗
394+ import ::= na:<nameattributes> ed:<externdesc> => (import na ed)
395+ export ::= na:<nameattributes> si:<sortidx> ed?:<externdesc>? => (export na si ed?)
396+ nameattributes ::= 0x00 len:<u32> en:<externname> => "en" (if len = |en|)
397+ | 0x01 len:<u32> en:<externname> => "en" (if len = |en|)
398+ | 0x02 len:<u32> en:<externname> a*:vec(<attribute>) => "en" a* (if len = |en|) 🏷️/🔗
399+ attribute ::= 0x00 len:<u32> in:<interfacename> => (implements "in") (if len = |in|) 🏷️
400+ | 0x01 len:<u32> vs:<semversuffix> => (versionsuffix "vs") (if len = |vs|) 🔗
401+ | 0x02 n:<name> => (external-id n) 🏷️
402402```
403403
404404Notes:
@@ -410,21 +410,26 @@ Notes:
410410 (which disallows core sorts other than ` core module ` ). When the optional
411411 ` externdesc ` immediate is present, validation requires it to be a supertype
412412 of the inferred ` externdesc ` of the ` sortidx ` .
413- * ` <importname> ` and ` <exportname> ` refer to the productions defined in the
414- [ text format] ( Explainer.md#import-and-export-definitions ) .
415- * ` <importname'> ` and ` <exportname'> ` will [ be cleaned up for a 1.0
416- release] ( ##binary-format-warts-to-fix-in-a-10-release ) .
417- * The ` <importname> ` s of a component must all be [ strongly-unique] . Separately,
418- the ` <exportname> ` s of a component must also all be [ strongly-unique] .
413+ * ` <externname> ` , ` <interfacename> ` and ` <semversuffix> ` are defined as part of
414+ the [ text format] ( Explainer.md#import-and-export-definitions ) .
415+ * The redundant ` 0x00 ` /` 0x01 ` cases of ` nameattributes ` will
416+ [ be cleaned up for a 1.0 release] ( #binary-format-warts-to-fix-in-a-10-release ) .
417+ * The ` externname ` s of all imports in a given component or component-type must
418+ be [ strongly-unique] ; attributes are ignored.
419+ * The ` externname ` s of all exports in a given component, instance, component-
420+ type or instance-type must be [ strongly-unique] ; attributes are ignored.
419421* Validation requires that ` [constructor] ` , ` [method] ` and ` [static] ` annotated
420422 ` plainname ` s only occur on ` func ` imports or exports and that the first label
421423 of a ` [constructor] ` , ` [method] ` or ` [static] ` matches the ` plainname ` of a
422424 preceding ` resource ` import or export, respectively, in the same scope
423425 (component, component type or instance type).
424426* 🏷️ Validation requires that ` implements ` -annotated imports or exports are
425- ` instance ` -typed.
426- * 🏷️ Validation requires that ` implements ` -annotated imports or exports have a
427- ` <plainname> ` name.
427+ ` instance ` -typed and have a ` plainname ` name.
428+ * 🏷️/🔗 Validation requires that a ` vec(<attribute>) ` contains each kind of
429+ ` attribute ` at most once.
430+ * 🏷️/🔗 Even though ` componenttype ` and ` instancetype ` structurally contain a
431+ ` vec(<attribute>) ` , this list is entirely ignored when validating the types
432+ of components and instances.
428433* Validation of ` [constructor] ` names requires a ` func ` type whose result type
429434 is either ` (own $R) ` or ` (result (own $R) E?) ` where ` $R ` is a resource type
430435 labeled ` r ` .
@@ -435,8 +440,6 @@ Notes:
435440 the ` versionsuffix ` results in a ` valid semver ` as defined by
436441 [ https://semver.org ] ( https://semver.org/ ) . A ` versionsuffix ` is otherwise
437442 ignored for validation except to improve diagnostic messages.
438- * ` <integrity-metadata> ` is as defined by the
439- [ SRI] ( https://www.w3.org/TR/SRI/#dfn-integrity-metadata ) spec.
440443
441444## 🪙 Value Definitions
442445
@@ -528,12 +531,9 @@ named once.
528531## Binary Format Warts to Fix in a 1.0 Release
529532
530533* The opcodes (for types, canon built-ins, etc) should be re-sorted
531- * The two ` depname ` cases should be merged into one (` dep=<...> ` )
532534* The two ` list ` type codes should be merged into one with an optional immediate
533535 and similarly for ` func ` .
534- * The ` 0x00 ` and ` 0x01 ` variant of ` importname' ` and ` exportname' ` will be
535- removed. Any remaining variant(s) will be renumbered or the prefix byte will
536- be removed or repurposed.
536+ * The redundant ` 0x00 ` and ` 0x01 ` opcodes of ` nameattributes ` will be merged.
537537* Most built-ins should have a ` <canonopt>* ` immediate instead of an ad hoc
538538 subset of ` canonopt ` s.
539539* Add optional ` shared ` immediate to all canonical definitions (explicitly or
0 commit comments