K
Kyle Schmitt
So I'm wondering, is this a bug, or not a bug, or a type-o in the docs?
According to http://www.ruby-doc.org/core/classes/Array.html
array*int "[R]eturns a new array built by concatenating the int
copies of self."
Copies should be brand new independent copies, right?
foo=[[nil,nil,nil]]returns a new array built by concatenating the int
copies of self.
foo*=3
#Foo is now.
#[[nil,nil,nil],
# [nil,nil,nil],
# [nil,nil,nil]]
foo[1][1]=12
#Foo is now
#[[nil,12,nil],
# [nil,12,nil],
# [nil,12,nil]]
#But I would have expected it to be
#[[nil,nil,nil],
# [nil,12,nil],
# [nil,nil,nil]]
According to http://www.ruby-doc.org/core/classes/Array.html
array*int "[R]eturns a new array built by concatenating the int
copies of self."
Copies should be brand new independent copies, right?
foo=[[nil,nil,nil]]returns a new array built by concatenating the int
copies of self.
foo*=3
#Foo is now.
#[[nil,nil,nil],
# [nil,nil,nil],
# [nil,nil,nil]]
foo[1][1]=12
#Foo is now
#[[nil,12,nil],
# [nil,12,nil],
# [nil,12,nil]]
#But I would have expected it to be
#[[nil,nil,nil],
# [nil,12,nil],
# [nil,nil,nil]]