<br><br><div class="gmail_quote">On Fri, Jul 17, 2009 at 2:22 PM, Ralph Boland <span dir="ltr">&lt;<a href="mailto:rpboland@gmail.com">rpboland@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
In my own Squeak project I have a method<br>
<br>
Dictionary&gt;&gt;rehash.<br>
<br>
I don&#39;t remember why I wrote this method but<br>
I just noticed that Dictionary&gt;&gt;rehash is not in<br>
the original  Squeak 3.10.2 code.<br>
Furthermore if used it should fail because<br>
it will inherit rehash from Set which doesn&#39;t<br>
work for Dictionaries.  My Dictionary&gt;&gt;rehash<br>
method is like the one in Set except<br>
associationsDo:  is used instead of  do:.<br>
<br>
Is this a bug?</blockquote><div><br></div><div>Which, the absence of the method, the default to Set&gt;&gt;hash or the use of associationsDo: ?</div><div>yes. yes. no.</div><div><br></div><div>Note that in our system we have</div>
<div><br></div><div>Dictionary methods for private</div><div><div>rehash</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Smalltalk rehash.&quot;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>| newSelf |</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>newSelf := self species new: self size.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>self associationsDo: [:each | newSelf noCheckAdd: each].</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>array := newSelf array</div><div><br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">What is the purpose of rehash anyway?</blockquote>
<div><br></div><div>Rehash arranges that a hashed collection&#39;s contents are again accessible after hashes have changed.  For example, if one changes the hash method(s) of classes of elements of hashed collections one would need to rehash afterwards to keep those collections working properly.  One common uses is on loading objects from some binary stream where the newly created loaded objects have different hashes than they had when they were saved, and hence hashed collections referring to those objects must be rehashed sometime during the load process.</div>
<div><br></div><div>So that the Dictionary&gt;&gt;rehash method is missing is a bug, and that you&#39;re doing the right thing is not.</div><div><br></div><div>HTH</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<font color="#888888"><br>
Ralph Boland<br>
<br>
</font></blockquote></div><br>