<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<font face="Georgia">I'm neutral on this, but here is a bit more
(and from earlier it would seem)<br>
<br>
</font><br>
<div class="codd" style="background-color: rgb(255, 255, 238);
padding: 4px; color: rgb(0, 0, 0); font-family: Georgia, Times,
serif; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
start; text-indent: 0px; text-transform: none; white-space:
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width:
0px; text-decoration-style: initial; text-decoration-color:
initial; max-width: 1000px;">'From Squeak3.7beta of ''1 April
2004'' [latest update: #5963] on 22 June 2004 at 8:51:57 pm'</div>
<div class="ceven" style="background-color: rgb(238, 255, 255);
padding: 4px; color: rgb(0, 0, 0); font-family: Georgia, Times,
serif; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
start; text-indent: 0px; text-transform: none; white-space:
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width:
0px; text-decoration-style: initial; text-decoration-color:
initial; max-width: 1000px;"><span style="color: blue;">"Change
Set: </span><span style="color: red; background-color:
yellow;">Behavior</span><span style="color: blue;">HashEnh v1.2<br>
Date: 22 June 2004, 16.02.2006<br>
Author: Stephan Rudlof, md<br>
md: added a line to the poscript to uncompactify the
MethodProperties class. We want to add an instVar for the
selector.<br>
Improves the default Object>>hash for<span> </span></span><span
style="color: red; background-color: yellow;">Behavior</span><span
style="color: blue;">s by installing<span> </span></span><span
style="color: red; background-color: yellow;">Behavior</span><span
style="color: blue;">>>hash. String>>hash has been
changed a little to avoid infinite recursion (without changing
its semantics).<br>
All is done in the postscript.<br>
<br>
Important<br>
-----------<br>
This is a special changeset: Do not export and import this
changeset again after importing it the first time! Then the
methods are not installed alone in the postscript anymore,
leading to serious problems!<br>
-----------<br>
<br>
Rationale: Object>>hash calling
ProtoObject>>identityHash gives poor results for<span> </span></span><span
style="color: red; background-color: yellow;">Behavior</span><span
style="color: blue;">s. Therefore a new<span> </span></span><span
style="color: red; background-color: yellow;">Behavior</span><span
style="color: blue;">>>hash using Symbol>>hash or
String>>hash (the latter slightly changed to avoide
infinite recursion) will be installed.<br>
<br>
Consequences:<br>
- It speeds up Set/Dictionary operations with<span> </span></span><span
style="color: red; background-color: yellow;">Behavior</span><span
style="color: blue;">s a lot (see below).<br>
- The main consequence for other objects as<span> </span></span><span
style="color: red; background-color: yellow;">Behavior</span><span
style="color: blue;">s seems to be a changed hash if they use<br>
self species hash<br>
as a start value for computing their hash.<br>
But AFAICS this doesn't hurt, since in most cases (non meta
classes as species) it maps to Symbol>>hash, which is
fast.</span></div>
<div class="moz-cite-prefix">On 11/21/18 7:31 AM, Levente Uzonyi
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:alpine.DEB.2.02.1811211052250.28585@login03.caesar.elte.hu">On
Tue, 20 Nov 2018, Chris Muller wrote:
<br>
<br>
<blockquote type="cite">
<blockquote type="cite">To make things more clear, the current
implementation of Behavior >> #hash
<br>
has two negative side effects:
<br>
- behaviors stored in collections relying on the hash value
(e.g. Set,
<br>
Dictionary) will have to be rehashed whenever a behavior is
renamed
<br>
- objects using Behavior >> #hash to implement their own
#hash, like what
<br>
Eliot just did to Message will suffer from the same issue. So
Sets and
<br>
Dictionaries holding those kind of objects will have to be
rehashed as
<br>
well upon the rename of the behavior.
<br>
<br>
My questions related to this:
<br>
- why does Behavior >> #hash rely on the name instead of
identity?
<br>
</blockquote>
<br>
If you mean #identityHash, then its because involving an
unstable
<br>
value in a #hash calculation is never a good idea.
#identityHash can
<br>
be different for the same class between two different images, or
if
<br>
the class was ever becomed or reloaded into a new image, etc.
<br>
</blockquote>
<br>
Is there an actual user of that feature?
<br>
<br>
Bob found out that #hash had been changed during the developement
of Squeak 3.9. Therefore this issue is not present in Cuis (forked
from 3.7). And I just checked Pharo and found that Behavior
>> #hash had been removed from there.
<br>
So, I suggest we remove it as well unless there's a really good
reason to keep it.
<br>
<br>
<blockquote type="cite">
<br>
<blockquote type="cite">- do we want to fix those issues
mentioned above or do we just say that
<br>
one should not rename classes and expect things to work?
<br>
</blockquote>
<br>
Neither. We just say that when one renames a class to rehash
all
<br>
relevant HashedCollections.
<br>
</blockquote>
<br>
That's "one should not rename classes and expect things to work",
isn't it?
<br>
<br>
Levente
<br>
<br>
<blockquote type="cite">
<br>
- Chris
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>