Hi Eliot,
(below) On 19/11/2018 02:32 p.m., Eliot Miranda via Cuis-dev wrote:
Hi All,
In VisualWorks Message implements #= & #hash naturally; two
messages whose selectors and arguments are #= are also equal. But in Cuis, Squeak and Pharo Message inherits #= and #hash from Object, i.e. uses identity comparison. This is, to say the least, annoying. Any objections to implementing comparing in Message to match VisualWorks?
_,,,^..^,,,_ best, Eliot
Just added these implementations to Cuis:
= aMessage "Any object is equal to itself" self == aMessage ifTrue: [ ^ true ]. self class == aMessage class ifFalse: [ ^false ]. selector = aMessage selector ifFalse: [ ^false ]. lookupClass = aMessage lookupClass ifFalse: [ ^false ]. ^args = aMessage arguments
hash "Hash is reimplemented because = is implemented." ^selector hash bitXor: args hash
Do they look ok? (I considered lookupClass for #=, but not for hash, as collisions because of that seem unlikely, and in any case, grouping them that way could be useful).
Cheers,