Comment by ๐Ÿ undefined

Re: "State diffing for undo?"

In: s/programming

Oh ok I think I get it. So anybody that wants to modify the state, instead of doing it directly, uses an auxillary function, and it does whatever paperwork needs to be done. I've thought about that, and it seems like a pretty good solution if every action is atomic, but the way I'm doing things now is that some actions can be partially conplete if they require user input. Maybe I could convert those to be atomic, but I'm not sure if that would work for all of them.

๐Ÿ undefined [OP]

2024-12-21 ยท 1 year ago

Original Post

๐ŸŒ’ s/programming

๐Ÿ undefined:

State diffing for undo? โ€” Let's say I can identify all the parts of the program that need to interact with undo/redo system, and put all of them into a single contiguous chunk of memory. Then, when someone creates an undo point, I just calculate a diff over that memory, more or less. What I'm interested in is, in your experience, is there a downside to this approach? The program doesn't do any network requests or database connections (and won't, for the forseeable future). Rn I'm using a system...

๐Ÿ’ฌ 7 comments ยท 2024-12-19 ยท 1 year ago