On 06/20/2012 05:25 PM, Hal Fulton wrote:
> 
> On Wed, Jun 20, 2012 at 5:06 PM, Jeremy Bopp <jeremy / bopp.net
> <mailto:jeremy / bopp.net>> wrote:
> 
>     So then, in what cases would it be helpful to use them interchangeably?
>      Is it possible to define a common, useful interface that both Symbol
>     and String could implement.  If so, perhaps a class or module could be
>     defined for that interface and incorporated into both classes as
>     appropriate.
> 
>     From what I've seen, the most frequently voiced desire is to be able to
>     use apparently equivalent symbols and strings as fully equivalent hash
>     keys.  What else is there?
> 
>  
> I suppose that's the biggest area of concern for me.
> 
> I do sometimes want to perform stringlike operations, e.g., on the parameter
> into method_missing, but that merely requires a single to_s. Likewise I
> sometimes
> want to add an equal sign onto a symbol in metaprogramming:
> 
>     (name.to_s << "=").to_sym

With regard to metaprogramming, perhaps the problem could be better
solved by allowing the things that currently consume only symbols to
also consume strings or really anything that provides a to_sym method.
That would also better follow the notion of duck typing.  I'm not sure
if this would help you in your particular case very much though.

I haven't heard any arguments for or against such an approach before.
As long as the related documentation was clear about the requirement of
a to_sym implementation that returns a Symbol instance, this wouldn't
appear to be a problem right off (... he says naively...).

-Jeremy