Infinite recursion #6
mikeaustin
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So Kopi recursion is not limited by the stack, since everything is asynchronous and chained by promises, but it can eat up the JavaScript heap, I think simply by holding on to previous function closures. There may be a way to invalidate no longer used environments, or maybe provide a native
selfbinding that when called loops instead of recurses, just like TCO.Currently, there is a
loopfunction that takes a function and applies until theexitfunction is called (first curried argument). If I add aprocess.gc()and asleep 1in the loop, it seems to keep memory at a constant value, which is good. I'm not sure if this method is 100% foolproof, though:Beta Was this translation helpful? Give feedback.
All reactions