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

David Sweeris davesweeris at mac.com
Thu Mar 2 09:54:09 CST 2017

> On Mar 2, 2017, at 06:22, Björn Forster via swift-evolution <swift-evolution at swift.org> wrote:
> Hello Joe,
> I wanted to ask kindly if it would be possible that the core team adds to the rationale the design decision behind 
>   associatedtype Magnitude : Equatable, ExpressibleByIntegerLiteral
> being not comparable. It was pointed out by several reviewers that it is against all intuition that a scalar is not comparable and therefore pretty much useless.
> It would be great if you could add the thoughts of the core team regarding this to the rationale to document the reasons behind it.

(Obviously I'm not Joe, nor do I speak for anyone)

IIRC, that was discussed in the thread: It isn't required for any stdlib or commonly used algorithms, and the constraint can easily be added to any code that does need it.
func foo <T: Numeric> (x:T) where T.Magnitude: Comparable {...}

- Dave Sweeris 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170302/64a5f975/attachment.html>

More information about the swift-evolution mailing list