Chr. Rippel wrote: > "Tobias Reif" <tobiasreif / pinkjuice.com> wrote in, > .... > There are two ways of resolving this inconsistency - I would prefer if > these operation would always return a String since this is an accordance > with the general behavior - i.e. if you want #upcase return a Foo it should > be your responsiblity to override it (a simple #dup.upcase!) Why? A Foo is a Foo and should stay a Foo, unless an explicit opertation is performed that changes it's class. Foo inherits methods from String. When Foo's methods are used, Foos are returned. When the inherited methods are used, Foos still should stay Foos. It's a big surprise if objects become other objects just because inherited methods are called on them. If a class inherits methods from ten levels of ancestors, then the poor object can go through ten different mutations, unintendedly. class Foo < String def cap_first sub(/./){$&.upcase} end end class Foozboozer < Foo def cap_last sub(/.\z/){$&.upcase} end end puts f01 = Foozboozer.new('blammo').upcase.type puts f02 = Foozboozer.new('blammo').cap_first.type puts f03 = Foozboozer.new('blammo').cap_last.type # -> all return a Foozboozer # otherwise, I would get a Foozboozer, a Foo, or a String back. Tobi -- http://www.pinkjuice.com/