<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Definitely a +1 from me, in fact I've implemented essentially this as an extension for my own convenience, but would definitely prefer it to be a proper component of the stdlib.</div><div class=""><br class=""></div><div class="">I have some queries to raise:</div><div class=""><br class=""></div><div class=""><ol class="MailOutline"><li class="">First is the naming, to me Ordering implies the enum itself is used for ordering collections but that's not really the case. In my own hacked implementation I'm using Order.before, Order.same, and Order.after. It's not much of a change, but it seems to clarify what the enum is, at least in my opinion.</li><li class="">One thing I was considering, but didn't do since my extension is just a bolt-on for convenience, is whether the before/ascending and after/descending cases should contain a value, allowing implementations to provide a hint of how far back/forward an element should be. This is a hint only of course, but could be useful; for example, when implementing a binary search you could instead use the hint value to provide a (hopefully) better guess at where to jump to next, for example if the value is very high you might jump to a position forward backward/forward rather than always selecting the middle every time. This is what Java's Comparable type does, since it uses a number where negative is before, 0 is same and positive is after.</li><li class="">Why is Equatable in this case implemented with a static .areSame() method, but Comparable isn't implemented by a static .compare() method? Seems like they should both be the same personally.</li><li class="">There should be a way to "flip" the operator. One thing that's great about the current sorting method is the ability to pass the &lt; or &gt; operators for ascending/descending respectively, we can do the first one by passing the &lt;=&gt; operator, but a flip function or something would be nice to, well, flip it (swap the ascending and descending cases before returning).</li></ol></div><div class=""><br class=""></div><div class="">Just some thoughts, but I definitely want this.</div><br class=""><div><blockquote type="cite" class=""><div class="">On 22 Jul 2016, at 02:11, Robert Widmann via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hello Swift Community,</div><div class=""><br class=""></div><div class="">Harlan Haskins, Jaden Geller, and I have been working on a proposal to clean up the semantics of ordering relations in the standard library. &nbsp;We have a draft that you can&nbsp;<a href="https://gist.github.com/CodaFi/f0347bd37f1c407bf7ea0c429ead380e" class="">get as a gist.</a>&nbsp; Any feedback you might have about this proposal helps - though please keeps your comments on Swift-Evolution and not on the gist.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class=""><br class=""></div><div class="">~Robert Widmann</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>