Make note in documentation about possible errors in patterns
Since users are able to construct possibly error containing patters, we need to note in the documentation that things like:
structure B with
data a.
data b.
end
-- No structure "A" exists
let p = pattern A(x,y).
let *p = B(1,2)
are valid programs up until the pattern match is attempted on the last line. Note we have not defined A to be anything.
The current approach to this is not unprecedented. Consider the following Python example,
>>> s = "0/0"
>>> eval(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
>>>
where we can construct a non-sensical computation as a string and pass it around without any consequences. It is only when we actually want to perform this computation that things blow up.
This situation is completely analogous to our pattern situation above, where we can construct a non-sensical pattern, pass it around etc, and things only blow up when we try to use it.