On Fri, Nov 12, 2010 at 12:25 PM, Josh Cheek <josh.cheek / gmail.com> wrote:

> On Fri, Nov 12, 2010 at 3:01 AM, Xavier Noria <fxn / hashref.com> wrote:
>
>> When the function is invoked the pointer is *copied*, that is, an integer
>> value is copied and linked to a local variable. The exact same thing
>> happens if the parameter is int i.
>>
>
> The exact same thing also happens with a reference (at least in C++, I don't
> know anything about Perl).
>
>
>> 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.