From: Chuckl Date: 2004-12-11T22:42:25+09:00 Subject: Re: How to make a deep copy of an object (Searching for Idiom) I've also been thinking about deep_copy, but for a different reason. I want to keep a mutation log for each object instance. So if this occurs: foo = Obj.new(:blah) foo.warp_blah! foo.twist_blah = :different_blah Then somewhere, preferably abstracted inside each object instance, I'd have a log like: puts foo.mutation_log => ["wrap_blah!", ["twist_blah=", :different_blah]] When the method Obj.checkpoint is called, the log is cleared and the current state returned as a Marshall-ing, or some other store-savable format. I understand this is not precisely the same thing as deep_copy, but I wonder if anyone else has done this? Obviously or not, I'm looking to implement an orthogonal persistence object system in ruby. Cheers, Chuckl