Message from JavaScript discussions

April 2017

— The best part is, it supposedly works on any recursive function under the sun, and is faster in JS due to not having to manage a call stack

Message permanent page


While you do have to manage state a lot more between "recursions", essentially you wrap the whole thing in a loop, then when you want to recurse you save state, then run continue myLoop;

— Implementing a stack to save state into is best because it then emulates the behavior of a real call stack

Message permanent page

— Without the RangeError :p

— Wow

— Fuck

— That's genious

— You mean tail call elimination?

— I don't think this is the same thing

— That's hardly new or novel and it does not work for all recursive functions

— Recursion by tricking the JS engine to recurse by loop

— Lua does that