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

Function closures #61

Closed
ahdinosaur opened this issue Sep 21, 2023 · 2 comments · Fixed by #62
Closed

Function closures #61

ahdinosaur opened this issue Sep 21, 2023 · 2 comments · Fixed by #62
Labels
enhancement New feature or request

Comments

@ahdinosaur
Copy link
Owner

Is your feature request related to a problem? Please describe.
You should be able to return a closure function.

Describe the solution you'd like

let
  equals: (a) => (b) => a == b
in
  equals(0)
    - 0

Implementation details
At the moment, we return functions as values, without the environment they "close over". A function value should now have an environment attached, which will be used when evaluating.

Describe alternatives you've considered

Additional context

@ahdinosaur ahdinosaur added the enhancement New feature or request label Sep 21, 2023
@ahdinosaur
Copy link
Owner Author

ahdinosaur commented Sep 21, 2023

first pass, using references and lifetimes, was terrible, and a dead-end: https://github.com/ahdinosaur/rimu/tree/function-closures

once i knew what to do, was straightforward: #62

ahdinosaur added a commit that referenced this issue Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant