From: "Gray, Jeff" Date: 2002-05-10T10:37:20+09:00 Subject: Reversing receiver and argument for commutative math operations Let's say I have a class that overrides certain arithmetic operators like + and *, so that obj = MyClass.new(5, "some other attribute") this_obj = obj * 2 # this_obj == MyClass.new(10) that_obj = 2 * obj # that_obj == this_obj is desired It seems that since coerce is called behind the scenes whenever a type mismatch like this occurs, that there would be some way to use coerce as a trap to "do the right thing". For example, I was hoping to simply swap the receiver and argument in the coerce return value, so that upon retrying MyClass#* would get called the second time around instead of Fixnum#*. But no dice, it just goes into an infinite loop. Is there a way to do what I'd like? Thanks, - jeff