From 8706d3c83bdd0fae4f156170383918d242bba684 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Fri, 20 Oct 2023 10:15:09 -0500 Subject: [PATCH] Disallow outer aliases of core module type from inside core module types Resolves #265 --- design/mvp/Binary.md | 6 ++++-- design/mvp/Explainer.md | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/design/mvp/Binary.md b/design/mvp/Binary.md index b8799257..a47c0185 100644 --- a/design/mvp/Binary.md +++ b/design/mvp/Binary.md @@ -168,8 +168,10 @@ core:exportdecl ::= n: d: => (export n d) ``` Notes: * Reused Core binary rules: [`core:import`], [`core:importdesc`], [`core:functype`] -* Validation of `core:moduledecl` (currently) rejects `core:moduletype` definitions - inside `type` declarators (i.e., nested core module types). +* Validation of `core:moduledecl` rejects `core:moduletype` definitions + and `outer` aliases of `core:moduletype` definitions inside `type` + declarators. Thus, as an invariant, when validating a `core:moduletype`, the + core type index space will not contain any core module types. * As described in the explainer, each module type is validated with an initially-empty type index space. * `alias` declarators currently only allow `outer` `type` aliases but diff --git a/design/mvp/Explainer.md b/design/mvp/Explainer.md index 517416bc..3e45a4d6 100644 --- a/design/mvp/Explainer.md +++ b/design/mvp/Explainer.md @@ -477,11 +477,12 @@ where strip-id(X) parses '(' sort Y ')' when X parses '(' sort ? Y ')' ``` Here, `core:deftype` (short for "defined type") is inherited from the [gc] -proposal and extended with a `module` type constructor. If module-linking is +proposal and extended with a `module` type constructor. If [module-linking] is added to Core WebAssembly, an `instance` type constructor would be added as well but, for now, it's left out since it's unnecessary. Also, in the MVP, -validation will reject nested `core:moduletype`, since, before module-linking, -core modules cannot themselves import or export other core modules. +validation will reject `core:moduletype` defining or aliasing other +`core:moduletype`s, since, before module-linking, core modules cannot +themselves import or export other core modules. The body of a module type contains an ordered list of "module declarators" which describe, at a type level, the imports and exports of the module. In a