The component model explainer has this to say about outer aliases, emphasis mine:
Because components, like modules, are pure values, outer aliases that reach across component boundaries are restricted to only refer to pure definitions: modules, components, and types that do not transitively refer to a resource type.
It also makes it clear, though, that 0 is a valid instance index for an outer alias:
In particular, the first u32 can be 0, in which case the outer alias refers to the current component/type.
These two together would seemingly imply that it is valid to do the following:
(component
(core module $m (func (export "foo")))
(alias core export $m "foo" (core func $foo))
(alias outer 0 $foo (core func $fooAgain))
)
But wasm-tools rejects this:
error: unexpected token, expected `module` or `type`
--> stoopid.wat:4:29
|
4 | (alias outer 0 $foo (core func $fooAgain))
| ^
It seems like wasm-tools has restricted all outer aliases to pure definitions, not just those that reach across component boundaries. Is this a bug in wasm-tools or the component spec?
The component model explainer has this to say about outer aliases, emphasis mine:
It also makes it clear, though, that
0is a valid instance index for an outer alias:These two together would seemingly imply that it is valid to do the following:
But wasm-tools rejects this:
It seems like wasm-tools has restricted all outer aliases to pure definitions, not just those that reach across component boundaries. Is this a bug in wasm-tools or the component spec?