[swift-evolution] [Accepted] SE-0104: Protocol-oriented integers

Nevin Brackett-Rozinsky nevin.brackettrozinsky at gmail.com
Sat Jul 2 07:02:20 CDT 2016

I’m glad this was approved, the improvements look substantial!

My one question is why are the bitwise operations (and/or/xor) modeled as
member functions rather than operators?

On Thursday, June 30, 2016, Chris Lattner via swift-evolution <
swift-evolution at swift.org> wrote:

> 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
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <javascript:;>
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160702/d68a2c7d/attachment.html>

More information about the swift-evolution mailing list