From: Christoph Rippel Date: 2001-02-26T16:59:49+09:00 Subject: [ruby-talk:11576] Re: Array bugs? > From: Ben Tilly [mailto:ben_tilly@hotmail.com] [...] > The key difference is the addition of the checks for > @@other_seen. If you don't have that, then you get > different results for this case: > > a = ["hello"] > b = (1..3).map {|x| a} > c = (1..3).map {|x| ["hello"]) > p (b == c) > p (c == b) > > Note that currently Ruby says these are equal. With > the method above Ruby says that they are different. > Compare though what these two do: > > b[0].push "world" > c[0].push "world" > > I think that calling them unequal is quite reasonable. No Ben this is not reasonable (practical at least;-) standard (ruby gives you) ------------------ [["hello"], ["hello"], ["hello"]] [["hello"], ["hello"], ["hello"]] "Now equal" true ------------------ a = ["hello"] b = (1..3).map {|x| a} c = (1..3).map {|x| ["hello"]} p b,c p "Now equal", (b == c) ----------------- Plenty of code relies on the " b == c" semantics - if you would change this all hell would break loose. [...] Christoph