[swift-evolution] [Accepted] SE-0104: Protocol-oriented integers
Chris Lattner
clattner at apple.com
Thu Jun 30 16:12:41 CDT 2016
Proposal link: https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md
Hello Swift Community,
The review of "SE-0104: Protocol-oriented integers" ran from June 22...27. The proposal is *accepted* for Swift 3 with revisions:
The feedback from the community was very positive and contributed a number of improvements to the design of the proposal. The core team has accepted the proposal, subject to the following changes:
- The “Integer" protocol should be renamed to “BinaryInteger” to be more accurate and avoid confusion between “Int" and “Integer”.
- The “FloatingPoint" protocol should conform to the “Arithmetic” protocol.
- Rename the “absoluteValue” property to “magnitude”, and sink it down to the “Arithmetic” protocol.
- Eliminate the “AbsoluteValuable" protocol, since “abs” can now be defined in terms of “Arithmetic".
- Rename the “signBitIndex" property to "minimumSignedRepresentationBitWidth".
- Add a “popcount" property requirement to the “FixedWidthInteger” protocol.
- Change the "countLeadingZeros()" member of concrete types to be a “leadingZeros” property on “FixedWidthInteger”.
- Rename "func nthWord(n: Int) -> UInt” to "func word(at: Int) -> UInt”.
- Rename the “and”, “or”, and “xor” members of “FixedWidthInteger” to “bitwiseAnd”, “bitwiseOr” and “bitwiseXor”.
- Change “doubleWidthMultiply” to be a static member, and add a “doubleWidthDivide” member as its dual. The latter will return both quotient and remainder of type “Self". Both are to be added to the "FixedWidthInteger" protocol.
Many thanks to Maxim Moiseev, Dave Abrahams and Dmitri Gribenko for driving this proposal forward, Steve Canon for his important input, and to Maxim Moiseev for driving the implementation work forward.
-Chris Lattner
Review Manager
More information about the swift-evolution
mailing list