From: "David A. Black" Date: 2007-09-30T20:30:23+09:00 Subject: Re: a = Dog.new # a is not a pointer and not a reference? Hi -- On Sun, 30 Sep 2007, Robert Dober wrote: > On 9/30/07, SpringFlowers AutumnMoon wrote: > >> how about just a.set_value(3) vs a->set_value(3). what i mean is just >> the "." and "->" difference. using a "." in Ruby and "->" in C or C++. >> If I think of "a" as a pointer and "." as "->", will that get in trouble >> and have any discrepancy for other things. > Yup 'cause '.' is not dereferencing period (pun intended). It is > sending a message > > x.a is almost equivalent to > x.send :a. > > Variables in Ruby are references, period again ;) but you cannot > dereference them. And I'd add that bareword identifiers are sometimes *not* variables, so x.a can mean something even if x is a method call. David -- Upcoming training from Ruby Power and Light, LLC: * Intro to Ruby on Rails, Edison, NJ, October 23-26 * Advancing with Rails, Edison, NJ, November 6-9 Both taught by David A. Black. See http://www.rubypal.com for more info!