On Sat, 17 Feb 2007 dblack / wobblini.net wrote: > You could conceivably have a case where an object can't be dup'd, but is > mutable, like a singleton class. If dup returns self, then you could end up > changing the object when you didn't want to. It's probably not an everyday > problem... but I still don't like the idea of having to remember that "dup" > means "dup or self". you already do though? harp:~ > cat a.rb # # crappy # h = { :point => 'we already have' } h2 = h.dup h2[:point] << ' that problem' p h[:point] # # crappy # h = { :point => 'we already have' } h2 = h.clone h2[:point] << ' that problem' p h[:point] # # sledge hammer # h = { :point => 'an imperfect solution' } mcp = lambda{|obj| Marshal.load(Marshal.dump(obj))} h2 = mcp[ h ] h2[:point] << ' is to use marshal' p h[:point] harp:~ > ruby a.rb "we already have that problem" "we already have that problem" "an imperfect solution" -a -- we can deny everything, except that we have the possibility of being better. simply reflect on that. - the dalai lama