-
Notifications
You must be signed in to change notification settings - Fork 30
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
Optimize tail calls #115
Labels
Comments
I looked at this a bit today with @alisomay and here are some notes from our discussion:
|
Some groundwork for this was done in #290. I didn't go any further because I'd like to understand more about how debugging might one day work before making any guarantees regarding tail calls. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently no effort is made in Koto to optimize tail calls, making it easy to run into stack overflows when implementing recursive functions.
e.g. The following script takes a huge amount of memory to execute:
The idea would be that if a terminating expression (i.e.
throw
orreturn
(implicit returns for the last expression in a function included)) in a function is a call, then instead of creating a new frame, the current function's execution frame can be reused.The text was updated successfully, but these errors were encountered: