'From Squeak3.2alpha of 4 October 2001 [latest update: #4475] on 8 November 2001 at 4:03:34 pm'! "Change Set: Set-Equal-tk Date: 8 November 2001 Author: Ted Kaehler Fixes the two bugs Scott reported: If you evaluate (Smalltalk = Smalltalk), you'll get a low space warning or a VM low-space crash, because we're truly in infinite recursion here. This is because Smalltalk itself is one of the values of one of the Associations within itself. '=' in Set has another flaw; it deems two Dictionaries equal if they have the same *values* even if their keys are totally different. Thus, if you evaluate the following in a workspace a := Dictionary new. a at: 'Frogs' put: 42. b := Dictionary new. b at: 'Toads' put: 42. a = b you will find that the two dictionaries are deemed equal."! !Set methodsFor: 'testing' stamp: 'tk 11/8/2001 15:35'! = aSet self == aSet ifTrue: [^ true]. "stop recursion" (aSet isKindOf: Set) ifFalse: [^ false]. self size = aSet size ifFalse: [^ false]. self do: [:each | (aSet includes: each) ifFalse: [^ false]]. ^ true! ! !Dictionary methodsFor: 'testing' stamp: 'tk 11/8/2001 15:56'! = other "Equal if it has my keys, is same size, and has the same corresponding value associated with each key." self == other ifTrue: [^ true]. "stop recursion" (other class = self class) ifFalse: [^ false]. "Do we want to require that they be of exactly the same class?" self size = other size ifFalse: [^ false]. self keysAndValuesDo: [:aKey :aValue | (other at: aKey ifAbsent: [^ false]) = aValue ifFalse: [^ false]]. ^ true! !