Crosscut

Daily Thought - 2024-04-18

Hey, I'm Hanno! These are my daily thoughts on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!

This thought was published before Crosscut was called Crosscut! If it refers to "Caterpillar", that is the old name, just so you know.

< back to list

Let's talk about debuggers. I think there's a core set of features that you would expect from one: set breakpoint, continue execution, step over this expression, step into this function call... you know, the well-known stuff. But what about stepping backwards?

I think to make Caterpillar truly interactive, this is a feature we need. No more, "oops, stepped too far; guess I'll have to restart". Instead, just rewind the program whenever you want. Maybe make a change to the code. Step forward again to observe your change. Repeat until you're happy.

I think this might be quite straight-forward to implement: For every instruction that gets executed, log the instructions that would undo its effect into a ring buffer. When stepping back, execute instructions from that ring buffer. But I think there is more to consider beyond this naive implementation, and that's what I'd like to write about over the next few days.

<< previous thoughtnext thought >>

Hey, you! Want to subscribe to my daily thoughts? Just let me know (maybe include a nice message, if you're up for it), and I'll send you an email whenever I post a new one.