From: Hal Fulton Date: 2012-06-21T07:25:54+09:00 Subject: Re: Symbols and Strings... --047d7b15a8a5cac6b204c2eee176 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Jun 20, 2012 at 5:06 PM, Jeremy Bopp 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 Hal --047d7b15a8a5cac6b204c2eee176 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Wed, Jun 20, 2012 at 5:06 PM, Jeremy Bopp= <jeremy@bopp.net> wrote:
So then, in what cases would it be helpful to use them interchangeably?
=A0Is it possible to define a common, useful interface that both Symbol
and String could implement. =A0If 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. =A0What else is there?

=A0
I suppose that's the biggest area of concern for me.
=
I do sometimes want to perform stringlike operations, e.g., on the para= meter
into method_missing, but that merely requires a single to_s. Likewise I som= etimes
want to add an equal sign onto a symbol in metaprogramming:
=A0=A0=A0 (name.to_s << "=3D").to_sym


Hal
<= br>
--047d7b15a8a5cac6b204c2eee176--