From: Justin Bailey Date: 2006-05-06T01:43:15+09:00 Subject: Re: Ruby 2.0: Symbol uniqueness? ------=_Part_27644_33408257.1146847388859 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This may be a question for the Ruby Core list? On 5/5/06, MenTaLguY wrote: > > I just learned yesterday that different string values can intern to the > same symbols; for example: > > p "!".intern =3D=3D "!@".intern # =3D> true > p "-(unary)".intern =3D=3D "-@".intern # =3D> true > > There aren't many such cases, but it makes life awkward if you're writing > code where two such strings are valid input (e.g. "!" and "!@" are both > valid, if unusual, identifiers in Scheme s-expressions). > > This seems to be a side-effect of the current implementation of unary > operators in Ruby 1.x -- is it slated for change in Ruby 2.0? > > I think it'd be nice if Ruby symbols were guaranteed to uniquely represen= t > string values, and x.intern.to_s =3D=3D x were an invariant for non-empty > strings. > > -mental > > > ------=_Part_27644_33408257.1146847388859--