Skip to content

Tail call optimization #7

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

Closed
sparkprime opened this issue Aug 10, 2014 · 1 comment
Closed

Tail call optimization #7

sparkprime opened this issue Aug 10, 2014 · 1 comment

Comments

@sparkprime
Copy link
Collaborator

The current implementations of foldl (and similar routines) rely on tail call recursion, but currently they blow the stack when operating on arrays that are too long. This can be fixed by optimizing tail calls to re-use their current stack frame.

I think an explicit construct for enabling the optimization is better than applying it for all tail calls, because then you preserve stack traces in the majority of cases where the optimization is not required.

@sparkprime
Copy link
Collaborator Author

Optimization is implicit for now. We may revisit this later, e.g. define a tail keyword and put it on the end of a function call. This could also implicitly force the arguments of the function, making code easier to write.

sbarzowski pushed a commit to sbarzowski/jsonnet that referenced this issue Jun 10, 2024
Finish up blocking out the parser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant