Caterpillar

Daily Thought - 2024-11-22

< back to list

The approach of logging "undo instructions" to get the ability to rewind the program won't work as described, if implemented in the current runtime. The problem is that executing instructions is currently not atomic. For example, the add instruction might pop its first argument from the stack, before noticing that there is no second argument left.

If we don't take this into account somehow and log instructions to undo the partially executed instructions, rewinding won't work from such a state. Which is relevant, because hitting some kind of error condition is probably going to be one of the prime reasons to want to rewind in the first place.

It's unclear to me how big of a problem this actually is. Once static typing is implemented, the case I described here can't happen anyway, because the compiler would notice the missing argument and not generate the add instruction in the first place. But still, it would be nice to just never have to worry about this causing any potential problems. I'll have thoughts on that tomorrow.

<< previous thoughtnext thought >>