SpringFlowers AutumnMoon wrote:

> $a = new Dog("lulu");   # a is a reference to "lulu" object
> $c = $a;                # c is a reference to "lulu" object
> $b = &$a;               # b is a reference to reference ?
> $b = new Dog("woofy");


actually, i think it would be better to name them differently:

$a = new Dog("lulu");   # a is a reference to "lulu" object
$c = $a;                # c is a reference to "lulu" object
$b = &$a;               # b is an alias to reference ?
$b = new Dog("woofy");

or

$a = new Dog("lulu");   # a is a pointer to "lulu" object
$c = $a;                # c is a pointer to "lulu" object
$b = &$a;               # b is a reference to pointer ?
$b = new Dog("woofy");

as they are different things.  before, i tend to think of alias as just 
a pointer, but people in C++ and Java told me i can't, because pointer 
can point any where, but an alias cannot.  we cannot change where an 
alias points to, and if we change anything, it will always be changing 
the thing where it points to.

Come to think about it, a pointer is very clear cut... an alias is very 
clear cut.  but when it is "reference", then you have to think whether 
it is the pointer behavior or the alias behavior.

-- 
Posted via http://www.ruby-forum.com/.