Looking at Apple’s Swift (4) docs at their SDK site, shouldn’t there be an 
“Integer” protocol between Numeric and BinaryInteger? Without that, there’s no 
solution for Integer types that are either a non-binary radix or a non-radix 
system (besides being over-broad with Numeric).

What would move there are: isSigned, quotientAndRemainder, signum, %, %=, /, 
and /=.

Also, how is ~ supposed to work in a BinaryInteger that is not a 
FixedWidthInteger? Extend the high bits to infinity? Maybe that operator should 
move to the derived protocol.

Oh, why can’t a non-binary Integer type be fixed-width? FixedWidthInteger 
should be renamed “FixedWidthBinaryInteger,” which derives from BinaryInteger 
and a new version of FixedWidthInteger. The new version peels off: max, min, 
addingReportingOverflow, dividedReportingOverflow, dividingFullWidth, 
multipliedFullWidth, multipliedReportingOverflow, remainderReportingOverflow, 
and subtractingReportingOverflow. There’s also a “digitWidth” type property, 
analogous to “bitWidth”.

Sent from my iPad
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to