Git redux

Okay, some code starting to appear here: github.com/iainmerrick/gift

I’m not going to analyse the branches and reconstruct high-level loop constructs—I’ll just emit spaghetti GOTOs, which LuaJIT should handle happily. Initially I’ll do all the stack operations explicitly, so it’s always in a suitable state for save and undo. Then as an optimization, well-behaved functions (fixed stack usage, no indirect branches, no calls except to other well-behaved functions) will store the whole Glulx stack frame in Lua local variables. I have one unfair advantage over Quixe: I can just have all Glulx calls be real Lua function calls, without worrying about blocking the main browser thread.

Lua is a really interesting language! There’s a lot of implicit and dynamic stuff going on, so it’s easy to make mistakes—more so than in Python, I’d say, and maybe almost as much as in Javascript. (In fact learning Lua might help me finally get my head around JS.) But it’s also really expressive. You can write in an OO style that feels very close to TADS, in both syntax and semantics; so it might make a decent language for IF, except I’m not sure if it’s possible to snapshot the program state.