It just occurred to me, though, that you could
fork()
before running each line of code. Then if that code caused a crash, you'd still have the old process state around, while if it didn't crash you could kill the old process. The only problem is for code that involved I/O, you wouldn't get a second chance... hmm. I suppose the same is true for a "normal" REPL anyway.[Edit: I later got around to implementing this. See the C REPL tag.]