music_notes
music_notes copied to clipboard
feat!: đź’Ą make comparator operators agree with `compareTo` and `==`
Fixes #477.
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 | |
|---|---|
| Change from base Build 10292837284: | 0.0% |
| Covered Lines: | 1254 |
| Relevant Lines: | 1254 |
đź’› - Coveralls
I would have probably removed the comparators from
IntervalandPitch(but keep theComparableinterface), 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.