[swift-evolution] [swift-evolution-announce] [Re-Review] SE-0104: Protocol-oriented integers

Howard Lovatt howard.lovatt at gmail.com
Tue Feb 21 17:05:58 CST 2017

The re-review of SE-0104 "Protocol-oriented integers" begins now and runs
through February 25, 2017. This proposal was accepted for Swift 3, but was
not implemented in time for the release. The revised proposal is available

> https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md
> • What is your evaluation of the proposal?

Well worth while. Few nit picks:

  1. Number.init? Description should say BinaryInteger not floating-point.
  2. Number should document that mutating versions of operators can
  3. SignedNumber should document that negate and unary `-` can overflow.
  4. SignedNumber, it is weird that `signum` is a function when other
similar things, e.g. `magnitude`, are properties.
  5. Not worth representing `DoubleWidth` as an enumeration, it is obscure
and therefore will only confuse people.
  6. It would be better to put the 'extra' operations into the protocols
and provide default implementations, otherwise they are difficult to find.

> • Is the problem being addressed significant enough to warrant a change to
> Swift?

Yes, the current design has not served my purpose on more than one occasion

> • Does this proposal fit well with the feel and direction of Swift?


> • If you have used other languages or libraries with a similar feature,
> how do you feel that this proposal compares to those?

Yes, this proposal is similar to what other languages provide, e.g. Scala.
In Scala however they tackle the `conversion problem as well in their
`traits heirarchy. I guess this could be added at a later date.

> • How much effort did you put into your review? A glance, a quick reading,
> or an in-depth study?

Read the proposal, have used similar features in other languages, and have
had trouble with Swift's current heirarchy.
-- Howard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170221/2254e187/attachment.html>

More information about the swift-evolution mailing list