@@ -227,6 +227,7 @@ component):
227
227
```
228
228
core:alias ::= (alias <core:aliastarget> (<core:sort> <id>?))
229
229
core:aliastarget ::= export <core:instanceidx> <name>
230
+ | outer <u32> <u32>
230
231
231
232
alias ::= (alias <aliastarget> (<sort> <id>?))
232
233
aliastarget ::= export <instanceidx> <name>
@@ -242,17 +243,19 @@ In the case of `export` aliases, validation ensures `name` is an export in the
242
243
target instance and has a matching sort.
243
244
244
245
In the case of ` outer ` aliases, the ` u32 ` pair serves as a [ de Bruijn
245
- index] , with first ` u32 ` being the number of enclosing components to skip
246
- and the second ` u32 ` being an index into the target component's sort's index
247
- space. In particular, the first ` u32 ` can be ` 0 ` , in which case the outer
248
- alias refers to the current component. To maintain the acyclicity of module
249
- instantiation, outer aliases are only allowed to refer to * preceding* outer
250
- definitions.
251
-
252
- There is no ` outer ` option in ` core:aliastarget ` because it would only be able
253
- to refer to enclosing * core* modules and module types and, until
254
- module-linking, modules and module types can't nest. In a module-linking
255
- future, outer aliases would be added, making ` core:alias ` symmetric to ` alias ` .
246
+ index] , with first ` u32 ` being the number of enclosing components/modules to
247
+ skip and the second ` u32 ` being an index into the target's sort's index space.
248
+ In particular, the first ` u32 ` can be ` 0 ` , in which case the outer alias refers
249
+ to the current component. To maintain the acyclicity of module instantiation,
250
+ outer aliases are only allowed to refer to * preceding* outer definitions.
251
+
252
+ As with other core definitions, core aliases are only supposed to "see" other
253
+ core definitions (as-if they were defined by Core WebAssembly extended with
254
+ [ module-linking] ). Thus, core ` outer ` aliases must have a skip-count of ` 0 `
255
+ when defined within a component, only allowing them to duplicate core
256
+ definitions in core index spaces. (Core ` outer ` aliases have a second use
257
+ described in the next section, which is why they are included in the grammar
258
+ at all.)
256
259
257
260
Components containing outer aliases effectively produce a [ closure] at
258
261
instantiation time, including a copy of the outer-aliased definitions. Because
0 commit comments