In few words, one measure is equal to another when their internal collaborators are equals between each other. And the hash of two measures are equals when the hash of their collaborators are equals too.
Then, some examples "#=" (1/2) = 0.5 "this evaluate to true" (1/2) ~= 0.5 "this evaluate to false" "#hash" (1/2) hash = 0.5 hash "this evaluate to true" (1/2) hash ~= 0.5 hash "this evaluate to false" Seeing the same with aconcagua | teaspoons aHalfTeaspoon anotherHalfTeaspoon | teaspoons := BaseUnit named: 'teaspoons'. aHalfTeaspoon := Measure amount: 1/2 unit: teaspoons. anotherHalfTeaspoon := Measure amount: 0.5 unit: teaspoons. "#=" aHalfTeaspoon = anotherHalfTeaspoon "this evaluate to true" aHalfTeaspoon ~= anotherHalfTeaspoon "this evaluate to false" aHalfTeaspoon unit = anotherHalfTeaspoon unit "this evaluate to true" aHalfTeaspoon unit ~= anotherHalfTeaspoon unit "this evaluate to false" aHalfTeaspoon amount = anotherHalfTeaspoon amount "this evaluate to true" aHalfTeaspoon amount ~= anotherHalfTeaspoon amount "this evaluate to false" "#hash" aHalfTeaspoon hash = anotherHalfTeaspoon hash "this evaluate to true" aHalfTeaspoon hash ~= anotherHalfTeaspoon hash "this evaluate to false" aHalfTeaspoon unit hash = anotherHalfTeaspoon unit hash "this evaluate to true" aHalfTeaspoon unit hash ~= anotherHalfTeaspoon unit hash "this evaluate to false" aHalfTeaspoon amount hash = anotherHalfTeaspoon amount hash "this evaluate to true" aHalfTeaspoon amount hash ~= anotherHalfTeaspoon amount hash "this evaluate to false" So, I don't see where is the bug. Regards. Maxi 2014-05-20 4:14 GMT-03:00 Guillermo Polito <[email protected]>: > I don't know about aconcagua, but as far as I know we have to keep the > following invariant to have well behaving hashed collections: > > if two objects a and b are equals, they should have the same hash. > > > On Tue, May 20, 2014 at 8:34 AM, Sven Van Caekenberghe <[email protected]>wrote: > >> >> On 20 May 2014, at 08:17, [email protected] wrote: >> >> > On Tue, May 20, 2014 at 7:28 AM, Sven Van Caekenberghe <[email protected]> >> wrote: >> > So ? >> > >> > 1/2 hash ~= 0.5 hash >> > >> > ((1/2) hash = 0.5 hash) true >> >> Yes, with the () they're equal... >> > >
