From: Lloyd Linklater Date: 2007-09-18T15:04:46+09:00 Subject: Re: The meaning of a = b in object oriented languages SpringFlowers AutumnMoon wrote: > Is that the case: if a is an object, then b = a is only copying the > reference? That and it adds a counter. a = ["foo", "bar"] b = a b[0] = "bite me" p a, b a = "different" p a, b *** In the first print, we get ["something else", "bar"] ["something else", "bar"] showing that changing b changes a, as expected. However, if we change a, b is NOT changed as seen in the second print. "different" ["something else", "bar"] That means that there is a counter inside that says to separate the two or b would have changed with a as a changed with b initially. -- Posted via http://www.ruby-forum.com/.