Closed verachell closed 2 years ago
I am working on a fix. The loop_iterator function is difficult to rewrite iteratively because it involves a nested recursive function. Initially I'm going to make it partially recursive (i.e. switch one of the recursive calls to iterative; leave the other recursive).
I have reason to believe this approach will work, because as proof of concept I created a simple stripped-down analogous program with a fully recursive and partially recursive version of the function. See https://gist.github.com/verachell/bd16905547f0ff00014e6a8b49f65e82 The fully recursive version winds up running out of stack space with an end parameter of 20000, while the partially recursive one works fine with those same parameters (altho be aware parameters bear no direct relationship to the YeetWords parameters). I'll be updating the status of this issue more frequently in its project card, see https://github.com/verachell/YeetWords/projects/1#card-72017363 . I'll just comment here on this issue thread for "big-picture" type of updates.
So if you are interested in closely following the status of this issue, look at the project card instead. I'm planning to do as much as I can on it within the next 48h so you can expect some updates on the project card in the near future.
The 1.1.2 release reflects this fix. Fixed by refactoring loop_iterator function to be partially iterative (vs branching recursive before). Also included are: fix: END-style commands can be used interchangeably as intended. fix: created a more consistent indicator of progress to the user in long LOOP and WRITE commands. fix: user receives warning message for large LOOP and WRITE parameter values (program continues). These changes were made together instead of incrementally because testing of these fixes overlapped.
This issue relates to a previous issue https://github.com/verachell/YeetWords/issues/3 . In certain situations, large loops such as the one below can result in Ruby running out of stack space and dropping out into the interpreter.
Most likely, the fix would be rewriting the loop_iterator function iteratively instead of recursively.