Strict Symbol Comparison in HashedCollections

In this case the issue is not with the receiver's equality (e.g. Dictionary>>#= = aDictionary "Two dictionaries are equal if (a) they are the same 'kind' of thing. (b) they have the same set of keys. (c) for each (common) key, they have the same value. See issue 16760 before changing" self == aDictionary ifTrue: [^true]. self species == aDictionary species ifFalse: [^false]. self size = aDictionary size ifFalse: [^false]. self associationsDo: [:assoc| (aDictionary at: assoc key ifAbsent: [^false]) = assoc value ifFalse: [^false]]. ^true ), but in the key lookup, i.e. in standard Pharo the following snippet answers a dictionary with 1 entry. With strict symbol comparison the dictionary will have two entries:

Dictionary new
	at: #a put: 1;
	at: 'a' put: 2;
	yourself
  

There are three broad approaches to dealing with this scenario:

Change the class of the collection

Replacing the instance creation of, e.g. Dictionary HashedCollection subclass: #Dictionary instanceVariableNames: '' classVariableNames: '' package: 'Collections-Unordered-Dictionaries' with GtStringContentDictionary Dictionary subclass: #GtStringContentDictionary instanceVariableNames: '' classVariableNames: '' package: 'GToolkit-PharoBasePatch-StrictSymbol-Collections' means that no further modifications are required since the string comparison is used even when strict symbol comparisons are enabled.

Ensure the key has the correct class when accessing

This can be done by converting the key just prior to use, e.g. aString asSymbol,

Ensure the key has the correct class when loading / initialising

This frequently occurs when loading data from json files, resulting in a dictionary having String keys when they would normally be expected to have Symbols.