From: Eric Hodel Date: 2005-03-17T06:03:22+09:00 Subject: Re: Symbol vs String --Apple-Mail-7--444202421 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 16 Mar 2005, at 12:37, Sebesty=E9n G=E1bor wrote: > Hi, > > Just a dumb question: what is the real difference between { :aKey =3D>=20= > "aValue" } and { "aKey" =3D> "aValue" } ? I know the first key is a=20 > symbol the latter is a string. I like string keys why should I use=20 > symbols? Why symbols worth to use as keys? Symbols take up less memory space (only allocated once for the same=20 Symbol) and have a faster #hash function (#object_id, not computed). 'x' =3D=3D 'x' # =3D> true 'x'.object_id =3D=3D 'x'.object_id # =3D> false :x =3D=3D :x # =3D> true :x.object_id =3D=3D :x.object_id # =3D> true --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Apple-Mail-7--444202421 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) iD8DBQFCOJ8IMypVHHlsnwQRAmGeAJwLyv+ruAK/YOTfbr4qZrO1ffJSMACfXbGE A5R0hzkC1Km6qqew0Vf+7tg= =5Ohh -----END PGP SIGNATURE----- --Apple-Mail-7--444202421--