From: Charles Oliver Nutter Date: 2006-10-19T08:58:52+09:00 Subject: Re: Symbol < String in Ruby > 1.8 Jim Weirich wrote: > Charles Oliver Nutter wrote: >> Fair enough if Symbols are more like Strings that have identity, but >> what of the narrowing of String's abilities in the Symbol subclass? If >> Symbol "is a" String, why will so many of String's methods be >> immediately unavailable? > > From a standpoint of the number of String methods available, it looks > like :abc will be similar to "abc".freeze. As Sam mentions in another post...what then is the difference between a Symbol and a frozen String? Why have a separate type? If there's a difference that's incompatible with String's behavior as a supertype, I don't think Symbol < String is valid. If there's no difference, I'm not sure I see the point in having Symbol. It seems to me that at best, Symbol exhibits some String-like behavior, but I wouldn't ever have thought Symbol "is a" String. Or perhaps Symbol "has a" String rather than "is a" String? I would be comfortable with that. String < Symbol is another option, but that would imply that all Strings are Symbols...that seems even less valid than saying all Symbols are Strings. -- Charles Oliver Nutter, JRuby Core Developer headius@headius.com -- charles.o.nutter@sun.com Blogging at headius.blogspot.com