<div dir="ltr">Hi Louis,<br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 2, 2018 at 9:12 AM Louis LaBrunda <<a href="mailto:Lou@keystone-software.com">Lou@keystone-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chris,<br>
<br>
On Fri, 2 Nov 2018 07:44:00 -0700, Chris Cunningham <<a href="mailto:cunningham.cb@gmail.com" target="_blank">cunningham.cb@gmail.com</a>> wrote:<br>
<br>
>ParcPlace-Digitalk VSE 3.1 (roughly 1999):<br>
><br>
>(0 to: 1) = (0 to: 5/3). "true"<br>
>(0 to: 1) hash = (0 to: 5/3) hash. "true"<br>
><br>
>So, ancient VSE and current VisualWorks are consistent, and agree on where<br>
>they want to be.  This is also the direction I want to take Squeak.<br>
>VA is also consistent, but #= doesn't match any other Smalltalk varient that we've looked at.<br>
>Squeak, Pharo, Dolphin all currently have the same answer, but are not<br>
>consistent.<br>
<br>
>Interesting indeed.<br>
<br>
I have been talking to the VA Smalltalk guys about this and they are thinking about it but haven't decided what to do<br>
yet.  It turns out that the way collections (like Set) that use #hash in VA Smalltalk work, because of the #= test<br>
failing for intervals that cover the same range and have the same hash, that it overrides the equal hash value and adds<br>
the interval to the collection.  I find this troubling.<br>
<br>
Lou<br></blockquote><div><br></div><div>The rules for = and hash are that if two object are #=, then their hash values have to be equal as well.</div><div><br></div><div>There is no statement about if two objects hashes are the same, what this means for equality.  This, I believe, is intentional.</div><div><br></div><div>The collection objects in (most?all?) smalltalks behave similarly to VA's - if objects have the same hash but are not equal, then they will both be in the hashed collection (such as Set).  The squeak implementation is described in Set>>scanFor: .  This method also shows why having objects equal but their hash not equal is so dangerous - if you had two objects that are supposed to be one and the same and are in fact #= but don't have the same hash, they can both show up in a Set together, or as keys in a Dictionary together, which breaks what we would expect.</div><div><br></div><div>But getting back to VA's collection issue that you have issues with - they are undoubtedly doing something similar in their collections that we do in Squeak, which is what is expected (although not necessarily obvious).</div><div><br></div><div>A long time ago, I took advantage of this and just hard-coded the hash for some of my classes to 1. This actually did work, but is a horrible (I mean HORRIBLE) idea - it really, really slows down the system when you have more than a couple instances of an object, but it does work.</div><div><br></div><div>-cbc</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
>thanks,<br>
>cbc<br>
><br>
>On Thu, Nov 1, 2018 at 5:40 AM Louis LaBrunda <<a href="mailto:Lou@keystone-software.com" target="_blank">Lou@keystone-software.com</a>><br>
>wrote:<br>
><br>
>> Hi Benoit,<br>
>><br>
>> On the latest version of VA Smalltalk:<br>
>><br>
>> VA Smalltalk V9.1 (32-bit); Image: 9.1 [413]<br>
>> VM Timestamp: 4.0, 10/01/18 (100)<br>
>><br>
>> I see:<br>
>><br>
>> (0 to: 1) = (0 to: 5/3). "false"<br>
>> (0 to: 1) hash = (0 to: 5/3) hash. "true"<br>
>><br>
>> Very interesting.<br>
>><br>
>> Lou<br>
>><br>
>><br>
>> On Thu, 1 Nov 2018 02:40:00 +0000 (UTC), Benoit St-Jean via Squeak-dev <<br>
>> <a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a>> wrote:<br>
>><br>
>> >Interesting!<br>
>> ><br>
>> >As a comparison:<br>
>> >Squeak 5.2<br>
>> >(0 to: 1) = (0 to: 5/3). "true"(0 to: 1) hash = (0 to: 5/3) hash. "false"<br>
>> >Dolphin 7(0 to: 1) = (0 to: 5/3). "true"(0 to: 1) hash = (0 to: 5/3)<br>
>> hash. "false"<br>
>> >VisualWorks 8.1.1(0 to: 1) = (0 to: 5/3). "true"<br>
>> >(0 to: 1) hash = (0 to: 5/3) hash. "true"<br>
>> >Pharo 5.0(0 to: 1) = (0 to: 5/3). "true"<br>
>> >(0 to: 1) hash = (0 to: 5/3) hash. "false"<br>
>> ><br>
>> >I don't have VAST installed on the PC I'm using right now.  I'd be<br>
>> curious to see how other Smalltalk and/or GemStone handle this?  So far<br>
>> (according to what I could test, only VW is right (according to the ANSI<br>
>> standard and just plain logic!)<br>
>> ><br>
>> >I wonder how much code relies on this "behavior" out there!<br>
>> >But the ANSI Smalltalk draft is very clear on this (revision 1.9, page<br>
>> 53, <a href="http://wiki.squeak.org/squeak/uploads/172/standard_v1_9-indexed.pdf" rel="noreferrer" target="_blank">http://wiki.squeak.org/squeak/uploads/172/standard_v1_9-indexed.pdf</a>):<br>
>> >"If the value of receiver = comparand is true then the receiver and<br>
>> comparand *must* have equivalent hash values."<br>
>> >That's what I always thought (or was taught or even read in the Blue<br>
>> Book).  Was this something that was changed at some point???<br>
>> ><br>
>> >----------------<br>
>> >Benoît St-Jean<br>
>> >Yahoo! Messenger: bstjean<br>
>> >Twitter: @BenLeChialeux<br>
>> >Pinterest: benoitstjean<br>
>> >Instagram: Chef_Benito<br>
>> >IRC: lamneth<br>
>> >Blogue: <a href="http://endormitoire.wordpress.com" rel="noreferrer" target="_blank">endormitoire.wordpress.com</a><br>
>> >"A standpoint is an intellectual horizon of radius zero".  (A. Einstein)<br>
>> --<br>
>> Louis LaBrunda<br>
>> Keystone Software Corp.<br>
>> SkypeMe <a href="callto://PhotonDemon" target="_blank">callto://PhotonDemon</a><br>
>><br>
>><br>
>><br>
-- <br>
Louis LaBrunda<br>
Keystone Software Corp.<br>
SkypeMe <a href="callto://PhotonDemon" target="_blank">callto://PhotonDemon</a><br>
<br>
<br>
</blockquote></div></div>