Skip to content

Commit a246a0a

Browse files
committed
Allow core outer aliases with depth greater than 1
1 parent c182ca9 commit a246a0a

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

design/mvp/Binary.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ Notes:
160160
initially-empty type index space.
161161
* `alias` declarators currently only allow `outer` `type` aliases but
162162
would add `export` aliases when core wasm adds type exports.
163-
* Validation of `outer` aliases cannot see beyond the enclosing core type index
164-
space. Since core modules and core module types cannot nest in the MVP, this
165-
means that the maximum `ct` in an MVP `alias` declarator is `1`.
166163

167164
```ebnf
168165
type ::= dt:<deftype> => (type dt)

design/mvp/Explainer.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -493,17 +493,13 @@ implicitly-created `func` type referring to both.
493493
Lastly, the `core:alias` module declarator allows a module type definition to
494494
reuse (rather than redefine) type definitions in the enclosing component's core
495495
type index space via `outer` `type` alias. In the MVP, validation restricts
496-
`core:alias` module declarators to *only* allow `outer` `type` aliases but,
497-
in the future, more kinds of aliases would be meaningful and allowed.
496+
`core:alias` module declarators to *only* allow `outer` `type` aliases (into an
497+
enclosing component's or component-type's core type index space). In the
498+
future, more kinds of aliases would be meaningful and allowed.
498499

499500
As an example, the following component defines two semantically-equivalent
500501
module types, where the former defines the function type via `type` declarator
501-
and the latter refers via `alias` declarator. Note that, since core type
502-
definitions are validated in a Core WebAssembly context that doesn't "know"
503-
anything about components, the module type `$C2` can't name `$C` directly in
504-
the text format but must instead use the appropriate [de Bruijn] index (`1`).
505-
In both cases, the defined/aliased function type is given index `0` since
506-
module types always start with an empty type index space.
502+
and the latter refers via `alias` declarator.
507503
```wasm
508504
(component $C
509505
(core type $C1 (module
@@ -513,7 +509,7 @@ module types always start with an empty type index space.
513509
))
514510
(core type $F (func (param i32) (result i32)))
515511
(core type $C2 (module
516-
(alias outer 1 $F (type))
512+
(alias outer $C $F (type))
517513
(import "a" "b" (func (type 0)))
518514
(export "c" (func (type 0)))
519515
))

0 commit comments

Comments
 (0)