Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

TIC-80

Fantasy computer for making, playing and sharing tiny games. · By Nesbox

Tail call on Duktape (js engine used by TIC-80)

A topic by minsik created Aug 29, 2021 Views: 163 Replies: 1
Viewing posts 1 to 2

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?

Developer

Hmm, hard to say, I think this question is more to the Duktape implementation