Actions
Bug #800
closedProblem with Array class
Description
=begin
If you test this simple program, you will see why array should be dup on assignment ...
a=1
b=1
c=[a,b]
def foo(x)
x[0] +=1
x[1] +=1
end
d = c
e = d
f = e
foo(f)
p c[0],c[1]
=end
Updated by radarek (Radosław Bułat) almost 16 years ago
=begin
No it shouldn't. Variables keeps references to objects, not objects itself. It is up to programmer if he wants to pass reference (as ruby do by default) or make clone (duplicate) of it.
=end
Updated by matz (Yukihiro Matsumoto) almost 16 years ago
- Status changed from Open to Rejected
=begin
No, it shouldn't. It will destroy the object model of the language.
=end
Actions
Like0
Like0Like0