From: Jason Roelofs Date: 2006-12-22T04:06:47+09:00 Subject: Re: Method named ***(other) ------=_Part_51380_18788131.1166728002523 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 12/21/06, Luciano Ramalho wrote: > > On 12/21/06, Vidar Hokstad wrote: > > You can't expand the set > > of operators, and '***' isn't among them. > > Thanks for the reply, Vidar. > > Is there a way I can ask irb to list all the operators which can be > overloaded? > > Cheers, > > Luciano > > "operators" are only special in that the parser is built to recognize a few constructs, mainly the mathematical operators (+, -, /, *, etc). For the programmer's case, they are all methods on some object, and all methods can be overwritten. So class A def +(args) end end class B def *(args) end end def /(args) end etc... Always keep in mind this simple feature: 1 + 1 => 1.+(1) and you'll realize that there really isn't "operator overloading" in Ruby, everything is just a message. Jason ------=_Part_51380_18788131.1166728002523--