[Nitro] OG [PATCH RFC]: Hash.dup -> deep copy function intended?

Mark Van De Vyver mvyver at gmail.com
Sat Sep 8 17:50:47 EDT 2007

Hi Devs,
Looking over some of the OG code I see a fair amount of `Hash#dup`, where
typically the Hash is some options hash passed in to the method.
Some times options are updated/deleted/altered.
I'm assuming the intent of the Hash#dup is to isolate any changes to
these options (if not, I'd be interested to know what value .dup
adds), but my understanding is that this (use of .dup) won't be the
case with Hash.dup, and a deep copy is required.
My Q is:
Is this right or is there some other reason for using Hash#dup?
Is Marshal.load(Marshal.dump(hash)) the preferred (for performance)
deep copy method?

OG examples:

./og/lib/og/store/model.rb 328, 348, 780
./og/lib/og/store/sql.rb 421

example patch attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mvdv-20070908-3.patch
Type: text/x-patch
Size: 63496 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20070909/87d388e3/attachment-0001.bin 

More information about the Nitro-general mailing list