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

Modular Type checking for Functions #471

Closed
DavePearce opened this issue Dec 19, 2024 · 1 comment · Fixed by #491
Closed

Modular Type checking for Functions #471

DavePearce opened this issue Dec 19, 2024 · 1 comment · Fixed by #491
Assignees
Labels
wontfix This will not be worked on

Comments

@DavePearce
Copy link
Collaborator

DavePearce commented Dec 19, 2024

Original corset accepts purefun_09, whilst this currently reports an error. The issue is really arising from the fact that we are type checking within the body of the defun. This makes sense, but its not backwards compatible. Specifically, we have something like this:

(defun (id (x :binary)) x)
(defun (f x) (id x))

Currently, f will not compile because id requires its parameter to be :binary. The fix is very simple: explicitly declare f as accepting (x :binary).

@DavePearce DavePearce added the wontfix This will not be worked on label Dec 21, 2024
@DavePearce DavePearce self-assigned this Dec 21, 2024
@DavePearce
Copy link
Collaborator Author

Overall, I think this is actually something we shouldn't fix. The error message simply forces us to put a parameter on the enclosing defun declaration, which is entirely sensible. It means we'll have to update the constraints to match this. If there are a large number of problem sites, then we may need to revisit this decision.

@DavePearce DavePearce changed the title Type checking for defpurefun is too restrictive Modular Type checking for Functions Dec 21, 2024
@DavePearce DavePearce linked a pull request Dec 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant