Hi --

On Thu, 25 Jul 2002, Tom Sawyer wrote:

> On Wed, 2002-07-24 at 19:23, David Alan Black wrote:
> > Hi --
> >
> > On Thu, 25 Jul 2002, Tom Sawyer wrote:
> >
> > >             @value = fxrb.to_s
> > >             self.value=fxrb.to_s  # why do i have to use self here?
> >
> > If you don't specify the receiver in "self.value = ...", Ruby will
> > interpret "value = " as meaning that value is a local variable, rather
> > than a method.  That's how Ruby disambiguates such expressions -- so
> > if you want it to be a method call, you have to disambiguate it in the
> > other direction by specifying "self".
>
> thanks david, that makes sense, but i'm confused in that i don't have to
> put the self on #event_change. in fact when i do it bombs. something to
> do with the = perhaps?

(Whoops, I quoted the line above the = line instead of the one below :-)

Yes, the '=' is the determinant.  In the case of the bare
"event_change", there's no indication to Ruby that this is anything
but a method call.

Lots of method calls will fail if you stick "self." on front of them,
so on its own that isn't an indication of a problem :-)


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav