From: Maksim Bartenev Date: 2006-12-15T01:52:45+09:00 Subject: Re: ------=_Part_152064_12319135.1166115163004 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Thank you for your reply. Does this mean that the interpreter uses a different strategy to select a method depending on whether the message recipient is explicitly specified, or not? Can you explain in a bit more detail, please? On 12/14/06, dblack@wobblini.net wrote: > > Hi -- > > On Fri, 15 Dec 2006, Maksim Bartenev wrote: > > > > On 12/14/06, pat eyler wrote: > >> > >> On 12/14/06, Maksim Bartenev wrote: > >> > Hi! > >> > > >> > I'm quite new to ruby language. Can anyone please explain why in the > >> > attached ruby code the setter methods return their argument > >> > instead of the last statement's value, and the string 'weird > >> > stuff' gets output only once? > > Methods ending with equal signs return the rhs, rather than their last > value, so that they'll be more assignment-like. That way, this: > > x = 1 > > and this: > > obj.thing = 1 > > have very close to the same sematics. > > As for 'weird stuff' getting printed only once: it's because you've > got dummy = true (a local variable assignment) instead of self.dummy = > true (a call to self.dummy=) in try_dummy2. > > > David > > -- > Q. What's a good holiday present for the serious Rails developer? > A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) > aka The Ruby book for Rails developers! > Q. Where can I get Ruby/Rails on-site training, consulting, coaching? > A. Ruby Power and Light, LLC (http://www.rubypal.com) > > ------=_Part_152064_12319135.1166115163004--