From: David Alan Black Date: 2002-07-17T06:23:11+09:00 Subject: Re: TkText no -textvariable workaround? Hi -- On Wed, 17 Jul 2002, Hal E. Fulton wrote: > ----- Original Message ----- > From: "ts" > To: "ruby-talk ML" > Cc: > Sent: Tuesday, July 16, 2002 12:23 PM > Subject: Re: TkText no -textvariable workaround? > > > > >>>>> "N" == Nat Pryce writes: > > > > N> If self has an attribute named 'a', then the receiver is self, and the > > N> method is 'a='. > > > > No, `a' is always interpreted as a local variable in this example > > Very perceptive. True even if > you do this: > > class Object > attr_accessor :a > end > > Within the object, I guess you > always need self to access something > like this. Any exceptions to this? I think that the only case you have to use self is when you're doing assignment (to prevent it from being taken for a local variable). If you're calling a reader method, you can do just 'a': irb(main):001:0> class Thing; attr_accessor :a; def thing; puts a; end; end nil irb(main):002:0> t = Thing.new; t.a = 3; t.thing 3 David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav