-
Notifications
You must be signed in to change notification settings - Fork 140
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
Errors in Analysis
#136
Comments
I agree this could be nice to have. Although I'm unsure about how a user would ever handle these errors. And if the user can't ever handle them, then it seems like just panicking is preferable. Do you have a use case for fallible union? Or rewrites? How would you recover from that? |
Some uses:
|
Ok, I am convinced of the use case, but this posed to be quite a viral change. Now basically everything can fail: adding e-nodes, unioning things, running rewrites, rebuilding. I'm not sure how much it makes sense to bubble these things up. For example, if you run a rewrite and some union fails at some point, do you keep the stuff the rewrite has done so far? Seems tricky. |
One related thing that may be really helpful (happy to open a separate request) would be including the name of the rule being applied when |
There are a variety of cases where an analysis might fail -- for instance, if it is trying to put type information it may fail to determine the result type when a new (invalid) node is created.
Some of these can be handled by type-checking before creating the egraph node(s). But, it seems like it could be helpful to allow the
Analysis
to define anError
type and have the methods returnResult<..., Self::Error>
. Existing Analysis implementations could use an infallibleError
, while analyses that wish to report errors could do so.This could also make it easier (in some cases) to debug errors using egraph -- if
merge
is called and produces an error it could indicate why things were being merged, etc. which would be easier to debug than a panic.The text was updated successfully, but these errors were encountered: