From: Gennady Date: 2003-05-06T15:53:11+09:00 Subject: Re: Variable/Method ambiguity On Monday, May 5, 2003, at 06:31 PM, dblack@superlink.net wrote: > > I don't think it's inconsistent. I think it would be inconsistent, > and confusing, if this: > > class A > def thing=(x); end > def other; thing = 100; end > end > > were different from this: > > class A > def other; thing = 100; end > def thing=(x); end > end These 2 cases would work the same, as actual execution happens after all methods are defined -- so it would call thing=() in both. > > or from this: > > class A > def blah=(x); end > def other; thing = 100; end > end > > As I understand it, the consistency is that, in all cases, the > receiver of a method must appear explicitly, unless both of these > things are true: > (a) the receiver is self; > (b) the variable could not be an already-defined local variable, > or a local variable in the process of being defined. > > I think this is the only algorithm that won't cause shifting behavior > in cases like the ones above. I know that I can use self.name= as Gavin suggested (it does not look pretty for my task, though) and I understand all consequences presented by David, and yet ... it was so tempting to want to be able to use it my way. Nevermind, I use slightly different approach now that works ;-) Gennady.