Skip to content

Commit 3019908

Browse files
committed
Fix reference to <core:name> to be <core:text> (because this is the text format, not the AST)
1 parent 90c6649 commit 3019908

2 files changed

Lines changed: 32 additions & 33 deletions

File tree

design/mvp/Explainer.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ The syntax for defining a core module instance is:
236236
core:instance ::= (instance <id>? <core:instancexpr>)
237237
core:instanceexpr ::= (instantiate <core:moduleidx> <core:instantiatearg>*)
238238
| <core:inlineexport>*
239-
core:instantiatearg ::= (with <core:name> (instance <core:instanceidx>))
240-
| (with <core:name> (instance <core:inlineexport>*))
239+
core:instantiatearg ::= (with <core:string> (instance <core:instanceidx>))
240+
| (with <core:string> (instance <core:inlineexport>*))
241241
core:sortidx ::= (<core:sort> <u32>)
242242
core:sort ::= func
243243
| table
@@ -247,17 +247,18 @@ core:sort ::= func
247247
| type
248248
| module
249249
| instance
250-
core:inlineexport ::= (export <core:name> <core:sortidx>)
251-
```
252-
When instantiating a module via `instantiate`, the two-level imports of the
253-
core modules are resolved as follows:
254-
1. The first `core:name` of the import is looked up in the named list of
255-
`core:instantiatearg` to select a core module instance. (In the future,
256-
other `core:sort`s could be allowed if core wasm adds single-level
257-
imports.)
258-
2. The second `core:name` of the import is looked up in the named list of
259-
exports of the core module instance found by the first step to select the
260-
imported core definition.
250+
core:inlineexport ::= (export <core:string> <core:sortidx>)
251+
```
252+
where [`core:string`] is the WebAssembly text format's quoted string literal.
253+
254+
When instantiating a module via `instantiate`, the two-level imports of the core
255+
modules are resolved as follows:
256+
1. The first import name is looked up in the named list of `core:instantiatearg`
257+
to select a core module instance. (In the future, other `core:sort`s could be
258+
allowed if core wasm adds single-level imports.)
259+
2. The second import name is looked up in the named list of exports of the core
260+
module instance found by the first step to select the imported core
261+
definition.
261262

262263
Each `core:sort` corresponds 1:1 with a distinct [index space] that contains
263264
only core definitions of that *sort*. The `u32` field of `core:sortidx`
@@ -294,9 +295,9 @@ instances, but with an expanded component-level definition of `sort`:
294295
instance ::= (instance <id>? <instanceexpr>)
295296
instanceexpr ::= (instantiate <componentidx> <instantiatearg>*)
296297
| <inlineexport>*
297-
instantiatearg ::= (with <name> <sortidx>)
298-
| (with <name> (instance <inlineexport>*))
299-
name ::= <core:name>
298+
instantiatearg ::= (with <string> <sortidx>)
299+
| (with <string> (instance <inlineexport>*))
300+
string ::= <core:string>
300301
sortidx ::= (<sort> <u32>)
301302
sort ::= core <core:sort>
302303
| func
@@ -316,9 +317,9 @@ future include `data`). Thus, component-level `sort` injects the full set
316317
of `core:sort`, so that they may be referenced (leaving it up to validation
317318
rules to throw out the core sorts that aren't allowed in various contexts).
318319

319-
The `name` production reuses the `core:name` quoted-string-literal syntax of
320-
Core WebAssembly (which appears in core module imports and exports and can
321-
contain any valid UTF-8 string).
320+
Component-level `string` literals reuse the Core WebAssembly text format's
321+
quoted-string-literal syntax which includes literals such as `"a"`, `"☃︎"`,
322+
`"\7f"` and `"\u{7fff}"`.
322323

323324
🪙 The `value` sort refers to a value that is provided and consumed during
324325
instantiation. How this works is described in the
@@ -338,14 +339,14 @@ instance, the `core export` of a core module instance and a definition of an
338339
`outer` component (containing the current component):
339340
```ebnf
340341
alias ::= (alias <aliastarget> (<sort> <id>?))
341-
aliastarget ::= export <instanceidx> <name>
342-
| core export <core:instanceidx> <core:name>
342+
aliastarget ::= export <instanceidx> <string>
343+
| core export <core:instanceidx> <core:string>
343344
| outer <u32> <u32>
344345
```
345346
If present, the `id` of the alias is bound to the new index added by the alias
346347
and can be used anywhere a normal `id` can be used.
347348

348-
In the case of `export` aliases, validation ensures `name` is an export in the
349+
In the case of `export` aliases, validation ensures `string` is an export in the
349350
target instance and has a matching sort.
350351

351352
In the case of `outer` aliases, the `u32` pair serves as a [de Bruijn index],
@@ -395,7 +396,7 @@ sortidx ::= (<sort> <u32>) ;; as above
395396
| <inlinealias>
396397
Xidx ::= <u32> ;; as above
397398
| <inlinealias>
398-
inlinealias ::= (<sort> <u32> <name>+)
399+
inlinealias ::= (<sort> <u32> <string>+)
399400
```
400401
If `<sort>` refers to a `<core:sort>`, then the `<u32>` of `inlinealias` is a
401402
`<core:instanceidx>`; otherwise it's an `<instanceidx>`. For example, the
@@ -493,8 +494,8 @@ core:moduledecl ::= <core:importdecl>
493494
| <core:exportdecl>
494495
core:alias ::= (alias <core:aliastarget> (<core:sort> <id>?))
495496
core:aliastarget ::= outer <u32> <u32>
496-
core:importdecl ::= (import <core:name> <core:name> <core:importdesc>)
497-
core:exportdecl ::= (export <core:name> <core:exportdesc>)
497+
core:importdecl ::= (import <core:string> <core:string> <core:importdesc>)
498+
core:exportdecl ::= (export <core:string> <core:exportdesc>)
498499
core:exportdesc ::= strip-id(<core:importdesc>)
499500
500501
where strip-id(X) parses '(' sort Y ')' when X parses '(' sort <id>? Y ')'
@@ -2350,7 +2351,7 @@ val ::= false | true
23502351
| <f64canon>
23512352
| nan
23522353
| '<core:stringchar>'
2353-
| <core:name>
2354+
| <core:string>
23542355
| (record <val>+)
23552356
| (variant "<label>" <val>?)
23562357
| (list <val>*)
@@ -3237,7 +3238,7 @@ For some use-case-focused, worked examples, see:
32373238
[`core:i64`]: https://webassembly.github.io/spec/core/text/values.html#text-int
32383239
[`core:f64`]: https://webassembly.github.io/spec/core/syntax/values.html#floating-point
32393240
[`core:stringchar`]: https://webassembly.github.io/spec/core/text/values.html#text-string
3240-
[`core:name`]: https://webassembly.github.io/spec/core/syntax/values.html#syntax-name
3241+
[`core:string`]: https://webassembly.github.io/spec/core/text/values.html#text-string
32413242
[`core:module`]: https://webassembly.github.io/spec/core/text/modules.html#text-module
32423243
[`core:type`]: https://webassembly.github.io/spec/core/text/modules.html#types
32433244
[`core:importdesc`]: https://webassembly.github.io/spec/core/text/modules.html#text-importdesc

design/mvp/WIT.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,10 +1748,9 @@ resource blob;
17481748
%[method]blob.read: func(self: borrow<blob>, n: u32) -> list<u8>;
17491749
%[static]blob.merge: func(lhs: borrow<blob>, rhs: borrow<blob>) -> blob;
17501750
```
1751-
These `%`-prefixed [`name`s](Explainer.md) embed the resource type name so that
1752-
bindings generators can generate idiomatic syntax for the target language or
1753-
(for languages like C) fall back to an appropriately-prefixed free function
1754-
name.
1751+
These `%`-prefixed strings embed the resource type name so that bindings
1752+
generators can generate idiomatic syntax for the target language or (for
1753+
languages like C) fall back to an appropriately-prefixed free function name.
17551754

17561755
When a resource type name is used directly (e.g. when `blob` is used as the
17571756
return value of the constructor above), it stands for an "owning" handle
@@ -1910,8 +1909,7 @@ is expanded into:
19101909
resource file
19111910
%[method]file.read: func(self: borrow<file>, n: u32) -> list<u8>;
19121911
```
1913-
where `%[method]file.read` is the desugared name of a method according to the
1914-
Component Model's definition of [`name`](Explainer.md).
1912+
where `%[method]file.read` is the desugared name of a method.
19151913

19161914

19171915
## Name resolution

0 commit comments

Comments
 (0)