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

Support failures in core lattice operations #21

Open
noahvanes opened this issue Jan 19, 2021 · 1 comment
Open

Support failures in core lattice operations #21

noahvanes opened this issue Jan 19, 2021 · 1 comment
Labels
Abstract domain Enhancement New feature or request

Comments

@noahvanes
Copy link
Collaborator

noahvanes commented Jan 19, 2021

Currently, at the level of our core lattices (IntLattice, StringLattice, …), failures (such as dividing by zero, sqrt’ing a negative number, etc.) are not dealt with. It the best case, they are ignored (e.g., when the index in stringRef is actually out of range); in the worst case, they can lead to Scala NaNs (dangerous!) or Scala exceptions.

We can use the existing MayFail monad to include such potential errors as the result of an operation in these core lattices (as is already done at higher levels in SchemeLattice and in the implementation of Scheme primitives).

@noahvanes
Copy link
Collaborator Author

noahvanes commented Nov 4, 2021

Similar to how failures are dealt with in the primitives, it might be better to employ monadic abstraction here (i.e., using the MonadError interface) instead of returning a MayFail for every operation. This would enable more flexibility in choosing how errors are dealt with in core lattice operations (e.g., a particular monad can then still choose to ignore failures), and bridge the gap between the implementation of the primitives and the lattice operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abstract domain Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant