From: Vidar Hokstad Date: 2006-12-22T02:10:10+09:00 Subject: Re: Method named ***(other) Julien Gaugaz wrote: > Ah, ok, thanks a lot. I understood why i could use '***' as an infix > operator. But still, there shouldn't be any difference between a call > like m.*** n and m.triple_star n... But it seems there is since > m.triple_star works and m.*** don't. > > I don't get it. Again, the only reason you can use a name like '**' is that it's one of the predefined operators. You can't just use any characters you want in a method name - the only method names you can use "special" characters like '*' in are method names matching the specific operators you can override. I think your confusion probably stems from the fact that this parses without errors: def *** other end Hower, try to run this: class Foo def *** other end end p Foo.new.methods.sort This should print out a sorted list of methods of instances of Foo. You'll see "**" shows up as the first method. The reason is that "def *** other" gets parsed as "def ** *other" (note the space). "*" in this case is the "splat" operator, that indicates that "other" will hold an arbitrary number of arguments in an array. So you haven't defined Foo#***, but Foo#**. Vidar Vidar