FogBugz (Case [Issue]7479) Kernel - hash and = inconsistent

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FogBugz (Case [Issue]7479) Kernel - hash and = inconsistent

Pharo Issue Tracker
A FogBugz case was edited by Camillo Bruni.

Case ID:      7479
Title:        hash and = inconsistent
Status:       Active
Category:     Bug
Project:      Kernel
Area:         Misc
Priority:     6 - Fix If Time
Milestone:    Later
Assigned To:  Everyone

URL:          https://pharo.fogbugz.com/default.asp?7479

hash and = inconsistent:
Collection >> hash, which is inherited by Dictionary and Set, includes self species hash.  But when Dictionary >> = is determining equality, it uses the predicate isDictionary, while Set >> = uses isKindOf: Set (ugh!)

I came across these while assigning to students the task of integrating alternate implementations of Set and Dictionary, which include making hash and = work.

I suggest that species be used everywhere for comparison, and /only/ for comparison.  In some cases, species is used to create the new collection for a copy, intersection, union, collect or select; I argue that this is wrong.  Normally copyEmpty should be used for that purpose, but sometimes, a particular class should be used, for example, SortedCollection collects into an OrderedCollection, and IndentitySet collects into a Set.  The numbers are right now the other way — there aer more uses of species in conversion and enumeration methods than there are of copyEmpty.


You are subscribed to this case.  If you do not want to receive automatic notifications in the future, unsubscribe (https://pharo.fogbugz.com/default.asp?pre=preUnsubscribe&pg=pgEditBug&command=view&ixBug=7479) from this case.

_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker