From: Eric Mahurin Date: 2005-06-04T06:29:06+09:00 Subject: Re: multiple assignments (was: method_missing and assignment) --- Patrick Gundlach wrote: > > [...] > > > It's not particularly a property of method_missing--you > can't even > > define a method to do this: > > > > irb(main):002:0> self.foo=(1,2) > > SyntaxError: compile error > > (irb):2: syntax error > > self.foo=(1,2) > > ^ > > from (irb):2 > > I should have tested the obvoius, thanks for this out. > > but something like method=(1,2) could be handy, for example > for > assigning complex numbers. > > Thanx, > > Patrick The above isn't valid syntax because it is being parsed as an assignment (not a method call) and (1,2) is not a valid expression (RHS). If you need something more complex, you can just assign with an array: self.foo = [1,2] There is an RCR open to attempt to be able to do this type of thing: self.foo(*args) = value which gets interpreted as self."foo="(*args,value). This is similar to the []= operator. __________________________________ Discover Yahoo! Use Yahoo! to plan a weekend, have fun online and more. Check it out! http://discover.yahoo.com/