Before, when I say Ruby's reference to an object

a = Car.new
b = a

i was saying a is a reference to a Car object. and b is now the same
reference to that object.

I mean it the very traditional pointer way:

int a = 10;
int *ip, *jp;
ip = &a;
jp = ip;

Now I didn't know that, as someone told me, that there is another type
of reference in C++, Java, and PHP:


i = 10
j =& i
j = 20
// and now both i and j are 20 (!!! shocked)
// is it to think of j as jpp? a pointer to pointer to int,
// and j = 20 involves implicit deferencing?  **jpp = 20
// or if it is an object,  *jp = &obj  ?


so I think when people talk about assignment in Python, Java, and Ruby,

a = b

is the first type of "Pointer reference"

and the second type is a "Alias reference"

Isn't that the case?  Is the above true so far?

In the PHP docs, it seems they intermix the two, and talk about PHP4's
=& the same way as PHP5's $obj1 = $obj2... and that was somewhat
imprecise.  In Ruby, we only have the "pointer reference" and that's it.
No need to worry about "alias" here and there.

(and in Ruby, we call a method by "pass by value, the value being the
reference (pointer) to an object).  and when the method returns
something, it returns a value, which is the reference to an object.)  It
is very consistent all the way.  In Ruby, we don't have the "alias
reference", right?
-- 
Posted via http://www.ruby-forum.com/.