From: Eric Bennett Date: 2001-04-13T22:07:08+09:00 Subject: [ruby-talk:13651] Re: operator + On Fri, 13 Apr 2001, ts wrote: > You'll have a problem with - Oh, that's what that mirror stuff was about - so you can seperate the forward and reverse forms: class Two class Mirror < Two def - (x) x - 2 end end def coerce(x) [ Mirror.new, x ] end def + (x) 2 + x end def - (x) 2 - x end end a = Two.new [ a + 2, 2 + a, a - 1, 1 - a ] #=> [3, 3, 1, -1] Thank you. Greatly enlightened. - Eric B. -- "Work is highly commutative"