From: Robert Klemme Date: 2004-05-14T18:08:57+09:00 Subject: Re: [RCR] subclasses of string as hash keys "Matthias Georgi" schrieb im Newsbeitrag news:opr7zia3wl7zr67k@mail.gmx.net... > On Fri, 14 May 2004 16:38:52 +0900, Robert Klemme wrote: > > > OTOH, you usually don't subclass String because there's so many places > > that create strings that you don't control (i.e #to_s etc.). > > If you have some string representing something sepcial, it's more OOP > to subclass, This is debatable - and there *have* been lengthy debates about that. For example, Java's class String is declared 'final', i.e. it can't be inherited from. I have only a slight tendency to not do it but I agree that there might be situations where subclassing is the more appropriate option. Though it seems to me that they are rather rare than common. Note also, that with Delegator you can quite easily wrap a String and add functionality as you see fit. > but the easiest way is to extend class String. > namespaces would be really good solution for that. How exactly would namespaces solve this problem? Regards robert