<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 24, 2016, at 11:03 AM, Chris Lattner <<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 24, 2016, at 9:35 AM, Jordan Rose via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div 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></div></blockquote><div class=""><br class=""></div><div class="">One of the ideas that Joe Pamer has been discussing is whether the implicit promotion from T to T? should be disabled when in an operator context. Doing so would fix problems like this, but making the code invalid.</div><div class=""><br class=""></div><div class="">Joe, is this something that you think will come up for discussion in the Swift 3 timeframe?</div></div></div></div></blockquote><div><br class=""></div><div>Yes - I believe so. I’ve been collecting my notes on the topic, with the hopes of getting a pitch out to swift-evolution soon.</div><div><br class=""></div><div>- Joe</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">Best,</div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div class=""><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=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a><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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></div></blockquote></div><br class=""></div>_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></body></html>