Tail recursion optimized? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
sirksel
Posts: 222
Joined: 12 Nov 2013, 23:48

Tail recursion optimized?

Post by sirksel » 20 Sep 2021, 12:06

Does anyone know if tail recursive calls are optimized in v2? In other words, if a recursive call is the last statement in a function, does the interpreter free the stack space of the penultimate call? I think the answer is no, based on a quick test I did with deep recursion. As I'm refactoring for beta1, I didn't want to waste time changing non-tail to tail recursion if the interpreter is indifferent between them. Thanks so much.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Tail recursion optimized?  Topic is solved

Post by swagfag » 20 Sep 2021, 12:57

they're not
Post Reply

Return to “Ask for Help (v2)”