Open yihozhang opened 1 month ago
FWIW in the Python bindings mutually recursive data types are supported through late binding type annotations. All classes/datatypes are translated to plain sort definitions & functions.
One advantage of this proposal is that it would still allow mutually recursive data types even if we made datatype closed, instead of open as it is now
Thought: Could make all types "lazy", that would support recursive data.... With the current syntax, then we just defer processing until it's defined.
Currently, datatypes cannot be mutually recursive. For example, the following is not allowed
OCaml supports mutually recursive type with the
type ... and ...
keyword. We can probably do something similar:Or
Or
Or (Jul 25 updates: we are more in favor of this syntax)
Or maybe there is a better syntax for this?
Another pattern we commonly have (but is not supported) is
Our recursive datatypes should also have a good support for this.