Daily Thought - 2024-11-19
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.
I'm sure there are many approaches for implementing expression-level rewinding, but the ones I could think of all boil down to a single principle: While you evaluate expressions, you log the information you need to undo those expressions later. Who does that logging, and what specifically is being logged, that's where the differences are.
As for who does the logging (or more precisely, who's responsible for making sure it happens), there are two candidates: the runtime and the compiler. I think having the compiler do it is more attractive overall, because that makes it easy to disable, leaving no runtime overhead; and because it's still going to work once Caterpillar is compiled to machine code (or WebAssembly).
But having the runtime do it might be the more practical option in the short term. As far as I can tell, that could be a relatively simple and robust solution, while having the compiler orchestrate it would be more complex, with more moving parts. Over the next few days, I'll be looking into this a bit more deeply.
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.