On Sep 29, 2007, at 10:17 PM, SpringFlowers AutumnMoon wrote:

> Morton Goldberg wrote:
>> On Sep 29, 2007, at 8:18 PM, SpringFlowers AutumnMoon wrote:
>>
>>> 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.
>>
>> No, you do not. Ruby has it own semantics, which do not correspond
>> with the semantics of C or C++. Trying to impose the semantics of
>> other languages onto Ruby isn't going to work. It's best to drop such
>> baggage and start fresh.
>
> hm,... but is there a problem to think of reference in Ruby as a
> "pointer"?  will that cause any trouble?   I only see that   
> a.value  is
> not the same as C and C++ would use a->value, but in Ruby we use  
> the "."
> to replace the "->" and that's it.  Will there be further trouble or
> discrepancy to think of Ruby reference as a pointer?

Well, your assertion that a.value is the equivalent of a->value is a  
good example of getting into trouble by equating a reference to a  
pointer. The expression a.value is a method call, not a value fetch.  
For a.value to work, the object referred by a has have a method  
called 'value', either an instance method or singleton method, in its  
extended object table. If it does, the method is executed and some  
object is returned. That's not at all what a->value does in C.

Regards, Morton