spire icon indicating copy to clipboard operation
spire copied to clipboard

Determine === and =!= strategy

Open denisrosset opened this issue 6 years ago • 2 comments

Let's group here a bunch of stuff:

#294 Support Eq in tests in a shouldEqv matcher (let's have a look) #601 BaseSyntaxTest uses .equals #599 No hashCode for Number #619 Remove === and =!= methods (PR) #423 Add === method for all data types (!) #405 Drop cooperative eq. or test it? #444 Add cooperative equality tests #508 More principled approach to equality #611 Quaternion and Complex use cooperative equality

denisrosset avatar Mar 19 '18 17:03 denisrosset

After discussion with @non:

  • We keep cooperative equality/hashCode for compatibility with collections and the OO world in general.
  • In parallel, we provide Eq and Hash instances.
  • This defines two parallel "worlds" under composition. We have to test that the definitions match using laws.
  • Data types should not have === and =!= methods as those are special. Adding methods for other operators is fine. For that, revisit @rklaehn work.
  • When the Eq typeclass calls a method on the type, call the method internal_eq or something similar.
  • These rules should go in the style guide.

denisrosset avatar Mar 22 '18 18:03 denisrosset

It appears the only remaining tracked issue here is the === and =!= strategy.

kschwarz1116 avatar May 30 '22 22:05 kschwarz1116