Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

Commit e405a67

Browse files
authored
Merge pull request #36 from WebAssembly/issue-30
Change outer alias count to start at the current module
2 parents 09c0da2 + cd40e18 commit e405a67

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

design/proposals/module-linking/Binary.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ Notes:
127127
* For instance-export aliases, `i` is validated to refer to an instance in the
128128
instance index space that actually exports `nm` with the specified definition
129129
kind.
130-
* For outer aliases, `ct` is validated to be *less than* the number of enclosing
131-
modules and `i` is validated to be a valid index in the specified
132-
definition's index space of the enclosing adapter module indicated by `ct`
133-
(counting outward, starting with `0` referring to the immediately-enclosing
134-
adapter module).
130+
* For outer aliases, `ct` is validated to be *less or equal than* the number
131+
of enclosing modules and `i` is validated to be a valid index in the
132+
specified definition's index space of the enclosing adapter module indicated
133+
by `ct` (counting outward, starting with `0` referring to the current adapter
134+
module).
135135

136136

137137
## Type Definitions

design/proposals/module-linking/Explainer.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,10 @@ aliases `$Outer`'s `$Libc` module, avoiding the need to manually import it:
544544
```
545545
Here, `$Outer` and `$Libc` serve as symbolic [de Bruijn indices], ultimately
546546
resolving to a pair of integers: the number of enclosing adapter modules to
547-
skip, and the index of the target definition.
547+
skip, and the index of the target definition. In particular, this number can be
548+
0, in which case the outer alias refers to the current module, allowing a
549+
single module to alias its own definitions at multiple indices in the index
550+
space (which can be [useful to tools][Issue-30]).
548551

549552
Adapter module definitions containing outer aliases effectively produce a
550553
module [closure] at instantiation time, including a copy of the outer-aliased
@@ -908,3 +911,5 @@ import Foo from "./foo.wasm" as "wasm-module";
908911
[Figma plugins]: https://www.figma.com/blog/an-update-on-plugin-security/
909912
[Attenuate]: http://cap-lore.com/CapTheory/Patterns/Attenuation.html
910913
[Default Export]: https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export#Description
914+
915+
[Issue-30]: https://github.com/WebAssembly/module-linking/issues/30

0 commit comments

Comments
 (0)