From: Eric Hodel Date: 2005-03-17T06:12:08+09:00 Subject: Re: Symbol vs String --Apple-Mail-8--443674714 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 16 Mar 2005, at 13:00, Nikolai Weibull wrote: > Also, using strings as symbols and then having the string altered will > force a rehash of the table. You mean this? key = 'foo' hash = {} hash[key] = 5 key.gsub! /foo/, 'bar' In this case, hash.rehash does not need to be called because Ruby copies String hash keys: hash.keys.first.object_id == key.object_id # => false Also, String keys are frozen, so you can't modify them: hash.keys.first.gsub! /foo/, 'bar' # => raises TypeError -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Apple-Mail-8--443674714 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCOKEXMypVHHlsnwQRAiIFAJ9uhVa8qCno1+gs+9xIC75uErjf5gCeIbFM CL5sVEygv3vRvIENHLgTr5w= =G32V -----END PGP SIGNATURE----- --Apple-Mail-8--443674714--