From: gwtmp01@... Date: 2005-12-07T14:49:21+09:00 Subject: Re: Mixins and variables On Dec 7, 2005, at 12:29 AM, Johannes Friestad wrote: > OK, thanks. Can I force "x=(whatever)" to mean a method call instead > of an assignment? > I thought the parantheses were supposed to do that? It is a parsing problem. Because ruby supports zero argument methods the parser when it sees: x = 4 can't decide from the syntax alone if this is a local variable assignment or if this is a method call to the x= method for the object (with 0 arguments). This decision needs to be made when the method is *parsed* long before the method has actually been executed. So the goal is to convince the parser of what you want. If you want this to be a method call then you have the following options: self.x = 4 # explicit method call x() = 4 # also explicit but not 'rubyish' Putting arguments around right-hand-side expression doesn't help the parser: x = (4) # no help here Neither does getting rid of spaces x=(4) # still no help The parser also learns as it goes along to help disambiguate other uses of the variable. See http://dev.rubycentral.com/faq/rubyfaq-4.html for more details (section 4.3)