Assume I have two different complex objects, a and b, which can each contain other objects or arrays. I want to get the diff of a and b in a way that I can 'apply' that patch to a to get b, or 'apply it in reverse' to b to get a. In other words, I want to be able to make a round trip, no matter how complex either object.
The reason I need this is that I want to be able to return to the various states of a record in a database over time. Every time the record changes, I want to store a patch, and I want to be able to play through the patches forward or backward to get to any previous state of that record.
Any help would be greatly appreciated.