music_notes icon indicating copy to clipboard operation
music_notes copied to clipboard

feat!: đź’Ą make comparator operators agree with `compareTo` and `==`

Open albertms10 opened this issue 1 year ago • 1 comments

Fixes #477.

albertms10 avatar May 13 '24 22:05 albertms10

Pull Request Test Coverage Report for Build 10293225635

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 10292837284: 0.0%
Covered Lines: 1254
Relevant Lines: 1254

đź’› - Coveralls

coveralls avatar May 13 '24 23:05 coveralls

I would have probably removed the comparators from Interval and Pitch (but keep the Comparable interface), since the comparisons are just order comparisons instead of "greater than" or "less than" comparisons, because they have an added "spelling" component: a A4 is different from a d5 as an Interval but in terms of size it's the same.

Thanks for the insight, which I partially agree with. While, in the end, both Interval and Pitch are, as you state, spellings, I still do not have enough arguments for removing the comparison operators. I do find semantics like “larger than” or “smaller than” work well with them: intervals can be larger or smaller than other ones, while pitches can be higher or lower than others.

As said, I prefer to keep comparators in both entities until I get to the conclusion they should not.

albertms10 avatar Aug 07 '24 23:08 albertms10