That was a deliberate design choice discussed during review of floating point protocols. Floating point remainder and integer modulo are very different. Spelling them the same way enables use in generic protocols, which would be incorrect uses. This was borne out by observation of erroneous uses of floating point % in Swift 2.<br><div class="gmail_quote"><div dir="ltr">On Fri, Feb 24, 2017 at 18:13 David Sweeris via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">On Feb 23, 2017, at 14:44, David Sweeris &lt;<a href="mailto:davesweeris@mac.com" class="gmail_msg" target="_blank">davesweeris@mac.com</a>&gt; wrote:<br class="gmail_msg"><br class="gmail_msg"></div><blockquote type="cite" class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg">On Feb 23, 2017, at 2:33 PM, Karl Wagner &lt;<a href="mailto:razielim@gmail.com" class="gmail_msg" target="_blank">razielim@gmail.com</a>&gt; wrote:<br class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg">On 23 Feb 2017, at 19:40, Max Moiseev &lt;<a href="mailto:moiseev@apple.com" class="gmail_msg" target="_blank">moiseev@apple.com</a>&gt; wrote:<br class="gmail_msg"><br class="gmail_msg">Conformance to Comparable is not required by anything in the standard library. Besides, it is always possible to further constrain your own code as in:<br class="gmail_msg"><br class="gmail_msg"></blockquote><br class="gmail_msg">Besides FloatingPoint, you mean? Or Collection indexes? Quite a lot of stuff, actually.<br class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg">func f&lt;T : Number&gt;(_ x: T) where T.Magnitude : Comparable {}<br class="gmail_msg"><br class="gmail_msg">I would argue that adding constraints without solid proof of them being useful and necessary is not the right thing to do.<br class="gmail_msg">Also, sorting things by magnitude will require using a predicate-based sorted() anyway, and that does not require Comparable.<br class="gmail_msg"><br class="gmail_msg">Max<br class="gmail_msg"></blockquote><br class="gmail_msg">Yes, but the constraints in the standard library should also convey some meaning and be useful. What do we mean by a “magnitude” anyway? Won’t it be strange in practice that I can create a “magnitude” out of nothing but an arbitrary integer literal but can’t compare two values? Ultimately it looks like a deficiency in the design to me - either it’s a simple scalar, ExpressibleByIntegerLiteral and Comparable, or it’s something more complex and can’t be either.<br class="gmail_msg"><br class="gmail_msg">This is exactly the kind of flaw I’ve been working around with the current Strideable.Stride (i.e. current SignedNumber). <b class="gmail_msg">If a type is ExpressibleByIntegerLiteral, you should be able to basically do all the things to it that you can do with an integer.</b><br class="gmail_msg"></blockquote><div class="gmail_msg"><br class="gmail_msg"></div>(replying to bolded part)<div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg">Not necessarily... Complex numbers can conform to `ExpressibleByIntegerLiteral` but not `Comparable`. At least not in a generally-accepted way.</div></div></blockquote><br class="gmail_msg"></div><div dir="auto" class="gmail_msg"><div class="gmail_msg">Perhaps a better example would be the `%` operator, since it involves stdlib types. Floating point types are ExpressibleByIntegerLiteral, but don&#39;t have the % operator that integers have.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">- Dave Sweeris</div></div>_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div>