Hi --

On Thu, 19 Oct 2006, Charles Oliver Nutter wrote:

> 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.

I wonder whether:

      module Textual
      end

      class String
        include Textual
      end

      class Symbol
        include Textual
      end

would make sense.


David

-- 
                   David A. Black | dblack / wobblini.net
Author of "Ruby for Rails"   [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog)        [2] | Co-director, Ruby Central, Inc.   [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org