From: matz@... (Yukihiro Matsumoto) Date: 2001-12-11T11:38:52+09:00 Subject: [ruby-talk:28166] Re: The benefits of dynamic typing? HI, In message "[ruby-talk:28155] Re: The benefits of dynamic typing?" on 01/12/11, "Harry Ohlsen" writes: |You can make this work the way you want (although, you'd have to stick |this code in a module and "require" it in all your code). Note that I'm |not known for writing the simplest version of things, so someone else |will probably have to clean it up for me (and I've only done the 1 + "1" |case for Fixnum; it would probably have to be coded more generally to be |useful) ... There's the better wasy: class String def to_int Integer(self) end def coerce(other) if other.integer? return other, Integer(self) else return other, Float(self) end end end class Numeric def to_str String(self) end end p "1"+1 p 1+"1" Selector namespace would help things like this. matz.