<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div>On Feb 23, 2017, at 14:44, David Sweeris <<a href="mailto:davesweeris@mac.com">davesweeris@mac.com</a>> wrote:<br><br></div><blockquote type="cite"><br class=""><blockquote type="cite" class="">On Feb 23, 2017, at 2:33 PM, Karl Wagner <<a href="mailto:razielim@gmail.com" class="">razielim@gmail.com</a>> wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On 23 Feb 2017, at 19:40, Max Moiseev <<a href="mailto:moiseev@apple.com" class="">moiseev@apple.com</a>> wrote:<br class=""><br class="">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=""><br class=""></blockquote><br class="">Besides FloatingPoint, you mean? Or Collection indexes? Quite a lot of stuff, actually.<br class=""><br class=""><blockquote type="cite" class="">func f<T : Number>(_ x: T) where T.Magnitude : Comparable {}<br class=""><br class="">I would argue that adding constraints without solid proof of them being useful and necessary is not the right thing to do.<br class="">Also, sorting things by magnitude will require using a predicate-based sorted() anyway, and that does not require Comparable.<br class=""><br class="">Max<br class=""></blockquote><br class="">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=""><br class="">This is exactly the kind of flaw I’ve been working around with the current Strideable.Stride (i.e. current SignedNumber). <b class="">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=""></blockquote><div class=""><br class=""></div>(replying to bolded part)<div class=""><br class=""><div class="">Not necessarily... Complex numbers can conform to `ExpressibleByIntegerLiteral` but not `Comparable`. At least not in a generally-accepted way.</div></div></blockquote><br><div>Perhaps a better example would be the `%` operator, since it involves stdlib types. Floating point types are ExpressibleByIntegerLiteral, but don't have the % operator that integers have.</div><div><br></div><div>- Dave Sweeris</div></body></html>