From: Josh Cheek Date: 2010-11-12T21:28:13+09:00 Subject: Re: what's an object? --0016364273ad3c0ac60494da39d0 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Nov 12, 2010 at 5:38 AM, Xavier Noria wrote: > On Fri, Nov 12, 2010 at 12:25 PM, Josh Cheek wrote: > >> The pointer value is copied into the number variable (pass by value). > >> You can be certain the caller sees the exact same pointer when > >> the function call returns. > >> > >> > > Please re-read your blog with this in mind, since what you right here in > > this quote are calling "pass by value" you, in your blog, call > > "pass-by-reference". > > > > http://img193.imageshack.us/img193/6480/refl.jpg > > No, no. If Ruby did what the diagram shows the program > > def m(b) > b = Object.new > p b.object_id > end > > a = Object.new > m(a) > p a.object_id > > would print the same number because a and b would be pointing to the > same storage area. They aren't. > > How can b change what a points to when, according to your own diagram, b does not have any reference to a? Here is the diagram which shows pass-by-reference and pass-by-object-reference http://img405.imageshack.us/img405/3699/ref1.jpg And I think your confusion itself is adequate justification for Ruby's style to deserve its own name "pass by object reference" Also, I would appreciate if more prominent Rubyists would weigh in on this. So far, I am disagreeing with everyone in this thread. I would like to know what the people that I have learned to respect think. I just disagree, because those on the other side seem so conspicuously wrong. But the number of people on that side seems disconcerting. I would like an objective measure in the form of people whose conclusions I can't roll my eyes at. --0016364273ad3c0ac60494da39d0--