From: Jim Freeze Date: 2003-07-22T02:05:18+09:00 Subject: Re: Deep copy On Tuesday, 22 July 2003 at 2:03:51 +0900, Jason Creighton wrote: > On Mon, 21 Jul 2003 18:31:21 +0200 > "Simon Strandgaard" <0bz63fz3m1qt3001@sneakemail.com> wrote: > > > On Tue, 22 Jul 2003 01:43:45 +0900, Jim Freeze wrote: > > > > > Hi > > > > > > I find that when I need to do a deep copy that I > > > usually just do the following: > > > > > > x = Marshal.load(Marshal.dump(y) > > > > > > > > > Is there a more concise (possibly faster) method that > > > combines these two steps? If not, should we add one? > > > > How about this ? > > > > http://www.rubygarden.org/ruby?StandardClassExtensions/Object > > > > class Object > def deep_clone > Marshal::load(Marshal.dump(self)) > end > end > > That's nice, but it is not in 1.8....yet. -- Jim Freeze ---------- If entropy is increasing, where is it coming from?