I think you might have hit on the right answer: what about putting the arithmetic in a separate package? What if we had
- FixedPointWrappingArthmetic
- FixedPointSaturatingArithmetic
- FixedPointCheckedArithmetic
- FixedPointFloatArithmetic
and the user/developer just picked one? The main issue I foresee is we now need some mechanism of package exclusion: since they would all override Base operators, we can’t have ImageCore picking FixedPointFloatArithmetic
while some other simultaneously-loaded package picks FixedPointCheckedArithmetic
.
In the modern world all these could live in the same repository, so it would ensure they all remain closely coupled.
Splitting out the arithmetic and defining in a secondary package is technically type-piracy, but it’s that closely-coupled form of piracy that I’ve long argued has a valid place in the ecosystem.