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

[CN] Consider using non-det. monad instead of explicit continuations #730

Open
dc-mak opened this issue Dec 2, 2024 · 0 comments
Open
Labels
cn technical debt Something for internal cleanup

Comments

@dc-mak
Copy link
Contributor

dc-mak commented Dec 2, 2024

The current implementation of backend/cn/lib/check.ml uses continuations to sort of dynamically let-normalise the core program.

This is done to avoid the need to handle join points and to terminate type checking early by ignoring the continuation in cases (symbolic) control flow is not meant to return to the parent AST node.

It has the downside of making the code a bit more fragile and less clear. Given that what we are essentially saying is that symbolic evaluation can return 0, 1, or many (i.e. for an if-expression, 2) symbolic values, using which the rest of the program must be checked, I wondered if this could be more cleanly implemented using a non-determinism/list monad: type checking passes if the program type checks with all values (including 0, vacuously).

It may also make any future specifications/formalisations of the type system easier.

@dc-mak dc-mak added cn technical debt Something for internal cleanup labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cn technical debt Something for internal cleanup
Projects
None yet
Development

No branches or pull requests

1 participant