According to Duktape documentation and this list (see DUK 2.3 column), Duktape, the Javascript engine used by TIC-80, implements tail call optimisation. However, the code below eventually crashes when it gets on call # 9997:
// title: game title // author: game developer // desc: short description // script: js function TIC() { cls() print('hello there!') recursive(0) } function recursive(i) { trace('recursive! ' + i) recursive(i + 1) }
I've been looking everywhere but no one seems to have any problem with Duktape itself. TIC-80 seems to be using its latest version (2.6.0) since version 0.90.1706, so the code above should be working.
Any thoughts on this? Maybe I'm too tired and missed some mistake I made on the code above?