Feature #950: More possibilities for operator overloading
http://redmine.ruby-lang.org/issues/show/950

Author: Michael Morgan
Status: Open, Priority: Normal

Operator overloading in Ruby is very powerful, but it would be even more useful if custom operators could be defined with supported characters. That way, methods such as  ***()  could be defined.

As an example of how this might be useful, I will use the above operator,  ***() .
In mathematics, addition is followed by multiplication. Multiplication, in turn, is followed by exponentiation. There are several more operations, called "hyper-operations", that follow these.
Ruby provides the ability to overload the operators corresponding to each of these. One can define methods for  +() , *() , and  **() . Logically,  ***()  would follow for tetration. Ruby, however, does not currently allow this. It would be useful, therefore, to allow any method with a sequence of legal operator characters to be defined.

Another thing that would be useful is the addition of overloaded operators that take no arguments. This might not be possible, but it would allow for the C-like increment operator,  ++() .


----------------------------------------
http://redmine.ruby-lang.org