Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Are recursive types allowed? #41

Closed
tlively opened this issue Nov 19, 2020 · 2 comments
Closed

Are recursive types allowed? #41

tlively opened this issue Nov 19, 2020 · 2 comments

Comments

@tlively
Copy link
Member

tlively commented Nov 19, 2020

The overview mentions that subtyping is co-inductive, but it does not explicitly state that type section entries can reference later type section entries. If a reader were to extrapolate from Wasm's existing declarations-before-uses structure, they might arrive at the conclusion that type section entries cannot reference later type section entries and therefore recursive types are not allowed. Can we clarify this one way or another in the explainer?

@rossberg
Copy link
Member

extrapolate from Wasm's existing declarations-before-uses structure

Yeah, in fact, I want to change this to def-before-use for types in this proposal, in order to avoid the recursive types rabbit hole for now. But that requires a few structural changes to validation and instantiation, which I haven't gotten round to implementing yet.

(Aside: Note that the property you describe only applies to the binary format, not to the abstract syntax or text format, where everything is considered recursive.)

@rossberg
Copy link
Member

rossberg commented Mar 8, 2022

Closing via #56.

@rossberg rossberg closed this as completed Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants