Dave Bass wrote:

> Eric Mahurin wrote:
>> No, ruby is still call-by-value.  The "value" is an object reference
>> (or simply an object in ruby terms).
> 
> So you pass a reference to a function. Isn't this call-by-reference???
[ SNIP ]

No, because you can pass a reference by value _or_ by reference. The
difference is basically this: if an argument is a reference, and it's
pass-by-value, the method has a _copy_ of the reference...you can use that
to make changes to the referenced object. But you cannot change - in the
method - what the reference points to in the calling code.

If you pass a reference by reference, you can make a change in the method to
what the reference points to, and the calling code will see this change.

It's not a fine distinction. It's why you cannot write a canonical object
swap function (using a temp variable) in Java, but can in C++.

AHS
-- 
* change 'two' to '2' to email me