Core type aliases with a depth larger than 1
Currently the Binary.md states:
Validation of alias declarators only allows outer type aliases. Validation of these aliases cannot see beyond the enclosing core type index space. Since core modules and core module types cannot nest in the MVP, this means that the maximum ct in an MVP alias declarator is 1.
but I would naively at least expect that there's no need to limit the depth here. For example with a component such as:
(component $C
(core type $t (func))
(component $C2
(core type (module
(alias outer $C $t (type $a))
(import "" "" (func (type $a)))
))
)
)
this seems like it should be valid but this validation rule currently prevents it from working.
Yeah, what you wrote makes intuitive sense; the only reason that the spec has this limitation is to account for the idea that the core layer isn't supposed to "know" anything about the component layer and so having the core module type validation rules "reaching up" through $C2 seems to break that layering. If we really wanted to spec that example to work, then we could sortof fudge it and say that, when validating a core type, the host passes in an ambient core nested type environment that could expose $t to the alias outer, but I was worried that this may have some negative ramification later that we'll regret, so I thought maybe we'd just start conservatively for now and consider relaxing later.
Incidentally, I think with what's specified now, the following should validate (achieving the type-sharing goal):
(component $C
(core type $t (func))
(component $C2
(alias outer $C $t (core type $t'))
(core type (module
(alias outer 1 $t' (type $a))
(import "" "" (func (type $a)))
))
)
)