#= and #hash

Martin Wirblat sql.mawi at t-link.de
Mon Aug 18 15:20:29 UTC 2003


See my fix at http://swiki.gsug.org:8080/sqfixes/3250.html.
It includes the redefinitions of #hash for about 10 classes ( the 
complete set for all missing redefinitions in 3.4 ).

Only the ones of your list which inherit #hash from Object are bugs.

Regards
Martin

Mike Roberts <mike at mjr104.co.uk> wrote on 18.08.2003 14:00:56:
>
>I have found a few more Text* objects that don't appear to behave 
>well in Sets due to the lack of an implementation of #hash when #= is 
>defined.  I thought I would have a look to see what the situation in 
>the image was like. 
>
>Using this code (any better/neater way of doing it let me know!)
>
>| hash equals |
>hash _ (SystemNavigation new allImplementorsOf:#hash) collect:[:i| i 
>classSymbol]. equals _ (SystemNavigation new allImplementorsOf:#=) 
>collect:[:i| i classSymbol]. (hash reject:[:i | equals includes:i]) 
>inspect. (equals reject:[:i | hash includes:i]) inspect.
>
>Gives the following results:
>
>Implementors of #hash but not #= directly
>ByteArray          #= from SequencableCollection
>Collection         #= from Object
>TranslucentColor   #= from Color (method says it handles this)
>
>Implementors of #= but not #hash directly
>CRLookupItem       #hash from Object
>CharacterBlock	   #hash from Rectangle
>CompiledMethod     #hash from ByteArray
>Dictionary         #hash from Collection
>Environment        #hash from Collection
>FlashLineStyle	   #hash from Object
>Heap               #hash from SequenceableCollection
>RunArray           #hash from SequenceableCollection
>Set                #hash from Collection
>SortedCollection   #hash from SequenceableCollection
>Symbol             #hash from String
>TextAlignment      #hash from Object
>TextAnchor         #hash from Object
>TextEmphasis       #hash from Object
>TextFontReference  #hash from TextFontChange
>TextKern           #hash from Object
>TextLine           #hash from Object
>TextLineInterval   #hash from Interval
>TextStyle          #hash from Object
>
>All those classes that implement #= but take #hash from Object are, I 
>think, bugs.  I'll make a start on tests/fixes for the Text* objects. 
>
>I just wanted to post this list to see if anyone more familiar with 
>these methods could see any potential problems. 
>
>Cheers,
>
>Mike




More information about the Squeak-dev mailing list