Bolt
Bolt copied to clipboard
It should not be possible to create infinite datatypes
Problem
Consider the following definition:
enum List a.
Nil
Pair a (List a)
Here, the recursive call to List a is wrapped in a Pair, which makes everything OK.
Imagine now the following type:
enum Node a.
Ref (Node a)
Here, the datatype is clearly invalid because to instantiate it you would need an infinite sequence of Refs.
The compiler needs a check to prevent this from happening.