From: Charlie Date: 2006-05-06T09:59:31+09:00 Subject: Re: Constant in Ruby. Austin Ziegler wrote: > On 5/5/06, Charlie wrote: >> from (irb):7 >> from :0 > > Do you understand *why* that worked? Consider it from: > > A = "Foo" > B = A > B.freeze > A << "Bar" > > -austin I show the object_id just for clarity, to show that A and B is 'referencing' or 'pointing' to the same object, although they do nothing. I thought I understand it until I try the example below for integers. Instead of showing errors, it gave very large bogus numbers, although results remain intact in the end. So, the answer to your question is that I don't. I think I might have missed out something here. A = 10 => 10 B = A => 10 B.freeze => 10 A << 20 => 10485760 B << 40 => 10995116277760 A => 10 B => 10 A.object_id => 21 B.object_id => 21 -- Posted via http://www.ruby-forum.com/.