Numberick icon indicating copy to clipboard operation
Numberick copied to clipboard

No extra `quotientAndRemainder(dividingBy:)` default

Open oscbyspro opened this issue 2 years ago • 1 comments

I provide three quotientAndRemainder(dividingBy:) defaults in NBKBinaryInteger.swift, which is one more than you'd expect. That's because the core integers do not compile without the where Self == Digit version. I think its an inelegant solution, but I'm not quite sure how to resolve it. If you've got any ideas, let me know.

func quotientAndRemainder(dividingBy other: Self) -> QR<Self, Self> { ... }
func quotientAndRemainder(dividingBy other: Self) -> QR<Self, Self> where  Self ==  Digit  { ... }
@_disfavoredOverload func quotientAndRemainder(dividingBy other: Digit) -> QR<Self, Digit> { ... }

oscbyspro avatar Jun 21 '23 08:06 oscbyspro

I believe this would not be an issue if it were possible to constrain the default digit methods to a scope where Self != Self.Digit.

oscbyspro avatar Jun 29 '23 12:06 oscbyspro