In article <991014401.628418.26898.nullmailer / ev.netlab.zetabits.com>, Yukihiro Matsumoto <matz / zetabits.com> wrote: >Hi, > >In message "[ruby-talk:15818] Re: is it possible to dynamically coerce objects types in Ruby?" > on 01/05/28, Mirian Crzig Lennox <mirian / cosmic.com> writes: > >|coerce is pretty nice, thank you. It seems that when I use coerce, I >|still have to define operators where MyClass is the left hand side of >|the expression; >|Is this correct? > >Yes. You have to pay the cost to join Numeric family. Okay. This gives me an idea: how about a module which implements all the operators with default behavior by calling the object's to_int method? That way, a class could include this module and then only override the methods which will be different for that class. Would this work? --Mirian