Issue 16598: Need to clarify how objects are compared by collection classes (alf-rtf) Source: (, ) Nature: Clarification Severity: Significant Summary: Several of the operations in the collection classes require that two general objects can be compared for equality (one example is Collection::includes). The standard should clarify how the equality comparison is done. Will the equality operator == always be used, or is it possible for the user to define the condition for how to compare objects of a user-defined class? If the equality operator == is used for all objects, this will limit the usefulness of the collection library. For some kinds of objects a comparison based on object identity is not appropriate. We propose that object identity comparisons is only the default for class objects, and that it can be customized by defining an equals operation in the class. Resolution: The FTF agrees that this is an issue worth considering, but, due to lack of time, decided to defer its resolution to a future RTF working on this specification. Revised Text: None Disposition: Deferred Revised Text: Actions taken: October 14, 2011: received issue October 5, 2012: deferred Discussion: End of Annotations:===== m: webmaster@omg.org Date: 14 Oct 2011 05:52:34 -0400 To: Subject: Issue/Bug Report ******************************************************************************* Name: Mattias Mohlin Employer: IBM mailFrom: mattias.mohlin@se.ibm.com Terms_Agreement: I agree Specification: ALF Section: 11.6 FormalNumber: ptc/2010-10-05 Version: FTF ­ Beta 1 Doc_Year: 2010 Doc_Month: October Doc_Day: 05 Page: 190 Title: Need to clarify how objects are compared by collection classes Nature: Clarification Severity: Significant CODE: 3TMw8 B1: Report Issue Description: Several of the operations in the collection classes require that two general objects can be compared for equality (one example is Collection::includes). The standard should clarify how the equality comparison is done. Will the equality operator == always be used, or is it possible for the user to define the condition for how to compare objects of a user-defined class? If the equality operator == is used for all objects, this will limit the usefulness of the collection library. For some kinds of objects a comparison based on object identity is not appropriate. We propose that object identity comparisons is only the default for class objects, and that it can be customized by defining an equals operation in the class.