Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make note in documentation about possible errors in patterns #177

Open
olwmc opened this issue Jun 6, 2022 · 1 comment
Open

Make note in documentation about possible errors in patterns #177

olwmc opened this issue Jun 6, 2022 · 1 comment
Labels
good first issue Good for newcomers

Comments

@olwmc
Copy link
Collaborator

olwmc commented Jun 6, 2022

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.

@olwmc olwmc changed the title Document possible errors in patterns Make note in documentation about possible errors in patterns Jun 6, 2022
@lutzhamel
Copy link
Collaborator

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.

@olwmc olwmc added the good first issue Good for newcomers label Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants