<div dir="ltr">On Tue, Feb 21, 2017 at 4:04 PM, Karl Wagner via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On 21 Feb 2017, at 21:39, Max Moiseev &lt;<a href="mailto:moiseev@apple.com" target="_blank">moiseev@apple.com</a>&gt; wrote:</div><br class="m_1718792384631845660Apple-interchange-newline"><div><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Feb 18, 2017, at 12:02 PM, Karl Wagner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_1718792384631845660Apple-interchange-newline"><div><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I assume the “SignedNumber” protocol is the same as the existing one in the standard library. That is to say, Strideable.Stride will now conform to Number and have operators.</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></div></blockquote>SignedNumber will *not* be the same. It is just the same name.</div><div>Stride will have operators, yes. Strideable in general will not, unless it’s a _Pointer. (you can find the current implementation prototype <a href="https://github.com/apple/swift/blob/new-integer-protocols/stdlib/public/core/Stride.swift.gyb" target="_blank">here</a>).<br></div></div></div></blockquote><div><br></div></span><div>Currently, it’s difficult to work with Strideable because you can calculate distances between them (as type Strideable.Stride), but you can’t add those distances because Strideable.Stride is only constrained to conform to “SignedNumber”, which is a pretty useless protocol.</div><div><br></div><div>In the prototype, Strideable.Stride has now been changed, so it is constrained to “SignedArithmetic” (which, apparently, is to be renamed “SignedNumber”). So essentially, the existing SignedNumber has been re-parented to “Number” and gains operations such as addition. That’s great!</div><div><br></div><div>I think it would be worth including Strideable in the “big picture” in the proposal/manifesto, showing how it fits in..</div><span class=""><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><blockquote type="cite"><div><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Also minor nitpick, would it be too onerous to require Number.Magnitude to be Comparable? Currently it’s only Equatable and ExpressibleByIntegerLiteral.</span></div></blockquote>Magnitude is supposed to conform to Arithmetic (or Number, or whatever it ends up being called), but the recursive constraints feature is missing, therefore we constrained it with the protocols that Arithmetic itself refines.</div><div><br></div><div>Why would you want Comparable?</div><div><br></div><div>Max</div><br></div></div></blockquote></span></div><br><div>I suppose that leads me on to the question of why Number itself only requires that conformers be (Equatable &amp; ExpressibleByIntegerLiteral) and does not require that they be Comparable.</div><div><br></div><div>If I must be able to create any “Number&quot; out of thin air with an integer literal, is it not reasonable to also require that I am able to compare two instances?</div><div><br></div><div>Are there Number types which can’t be Comparable?</div></div></blockquote><div><br></div><div>Complex numbers. I believe `Number` is designed to allow a complex number type to conform.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>- Karl</div></div><br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div></div>