From: "Albert L. Wagner" Date: 2002-02-18T23:12:40+09:00 Subject: Re: OOP overhead (Was: tiny contest...) Dave Thomas wrote: > > Agreed, but in this particular case, the code is changing from (say) > > wordlist.each do |word| > hashed_word = hash_of(word) > anagrams[hashed_word] = word > end > > to > > def String.hash > hash_of(word) > end > > wordlist.each do |word| > anagrams[word.hash] = word > end > > which effectively doubles the number of method calls (because hash_of > is a method call itself. You are right, of course. But this particular case was a kludged attempt to make hash-as-hash-key work. > > Dave