From: Austin Ziegler Date: 2003-12-24T09:50:04+09:00 Subject: Re: Does String cache its 'hash' return value? On Wed, 24 Dec 2003 09:06:51 +0900, Asfand Yar Qazi wrote: > Florian Frank wrote: >> On Tue, 2003-12-23 at 01:56, Asfand Yar Qazi wrote: >>> What I mean is, if I repeatedly call a String's hash method (i.e. >>> like using it regularly to access a Hash) will the hash value get >>> recalculated every time? >> Yes, it will. Have you considered unsing Symbols instead of Strings? >> The hash value "calculation" of a Symbol is O(1). > Depends... if Symbols are used as the keys for a hash table, can they be > as easily accessed from extension modules as if Strings were used? I don't understand your question. MyModule.config(:bar => "baz") You will need to document the hash parameters regardless of whether it's "bar" or :bar. Strings can also be converted to Symbols with #intern. -austin -- austin ziegler * austin@halostatue.ca * Toronto, ON, Canada software designer * pragmatic programmer * 2003.12.23 * 19.47.42