I'm not that knowledgeable in this matter so I decided to ask here. Let's say we have some 'library' in Ruby (or any other pass by reference scripting language):
class Moo
attr_accessor :bar
def initialize
self
end
end
a = 'a string'
b = Moo.new
b.bar = a
b.bar will obviously be the same object as a.
Is it right to leave it as it is in all cases so programmer who need them separate will do cloning manually? That's the only sane idea I ended up with.