<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I wouldn’t phrase it this way. “nil” could just as easily been above all of the integers.</div><div class=""><br class=""></div><div class="">We added overloads for < and friends that took optionals so that you could sort an array by passing < and get something reasonable out without having to provide your own comparison function, but you’re not the first to find it counterintuitive. We could consider removing it (going through the <a href="https://github.com/apple/swift-evolution/blob/master/process.md" class="">Swift Evolution Process</a>).</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On May 24, 2016, at 09:07, Robert Widmann via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Behaves as intended, albeit counterintuitively.<br class=""><br class="">[~ indicates appropriate coercion]<br class=""><br class="">1) (nil : Optional<T ~ Int>) == (0 : Int ~ Optional<Int>) false because nil is the lower bound of all possible integers.<br class="">2) (nil : Optional<T ~ Int>) < (0 : Int ~ Optional<Int>) true for reasons above<br class="">3) (nil : Optional<T ~ Int>) > (0 : Int ~ Optional<Int>) false for reason above.<br class=""><br class="">~Robert Widmann<br class=""><br class="">2016/05/24 2:27、Yaman JAIOUCH via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> のメッセージ:<br class=""><br class=""><blockquote type="cite" class="">nil == 0 // false<br class="">nil < 0 // true<br class="">nil > 0 // false<br class=""><br class="">Is this a potential bug or an intended behavior ?<br class="">_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></blockquote>_______________________________________________<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></div></blockquote></div><br class=""></body></html>