On Tue, 2 Sep 2003 17:21:31 +0900, oleg dashevskii wrote: > I've got a big object that holds references to other objects which, in > turn, hold references to other objects, which..... > > Now I change this object, but need a possibility to revert the change. > This could be achieved by deep-copying the object, but that's too > expensive (changes are mostly minor and 99% copy operations will be > redundant). > > Is there any simple solution to this, employing the copy-on-write > principle? I realise you want to avoid deep-copying, but I don't really see a clean way of doing it without. I have released a library that simplifies such transactional operations, Transaction::Simple. http://raa.ruby-lang.org/list.rhtml?name=trans-simple I'm using this on a PDF creation library written entirely in Ruby, and it works *fast* with 1.8, requiring about 180k for the first transaction level. Other levels require more. -austin -- austin ziegler * austin / halostatue.ca * Toronto, ON, Canada software designer * pragmatic programmer * 2003.09.02 * 12.35.02