From: Vladimir Sizikov Date: 2008-08-02T09:02:16+09:00 Subject: [ruby-core:18076] Equality of recursive arrays Hi, I'm currently writing RubySpecs for all Array methods with recursive arrays, and I noticed something that I'd like to double-check with you. Essentially, the equality is not working right for recursive arrays, at least it seems that it doesn't work right for me: Case #1: a = [] a << a b = [] b << b a == b #=> returns *false* Is that expected or bug? The inspect values are the same. On the other hand, when we use #dup: Case #2: a = [1] a << a b = a.dup a == b #=> returns *true* But if you look at the inspect values for a and b, you'll see: a: [1, [...]] b: [1, [1, [...]]] This seems to be weird. So, in the first case, the values seem to be equal, but #== returns false for them, and in the second case, the values seem to be different, but #== returns true. Huh? Thanks, --Vladimir