Call-by-reference problem again

Hi All,

I thought this problem over, and I admit I’m wrong, what I see the
difference is that:

a=b=c=d=Array.new

a<< string

Then b, c, d all changed, but if you use a=[string], b, c, d will not
change. This is because by the assignment, a is pointed to some new array
object…

Shannon

···

That’s no different than:

a=b=c=d=e=[1, 2, 3]
a=[4, 5, 6]

That’s my point. There’s nothing special about Array in Ruby… but the
’ notation which is just syntactic sugar anyway.


Protect your PC - get McAfee.com VirusScan Online
Antivirus, VPN, Identity & Privacy Protection | McAfee