<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="">I have personally (ab)used this for the following:<div class=""><br class=""></div><div class="">class User {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>var email: String</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>var firstName: String?</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>var lastName: String?</div><div class="">}</div><div class=""><br class=""></div><div class="">You have a list of users based on email, so last name is optional. In Swift 2.x, you can do:</div><div class=""><br class=""></div><div class="">users.sort({ $0.lastName &lt; $1.lastName })</div><div class=""><br class=""></div><div class="">Now, you need to do:</div><div class=""><br class=""></div><div class="">users.sorted({<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>guard&nbsp;let&nbsp;firstName = $0.0.lastName&nbsp;else&nbsp;{<br class=""><span class="Apple-tab-span" style="white-space:pre">                </span>return&nbsp;true<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>guard&nbsp;let&nbsp;secondName = $0.1.lastName&nbsp;else&nbsp;{<br class=""><span class="Apple-tab-span" style="white-space:pre">                </span>return&nbsp;false<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>return&nbsp;firstName &lt; secondName<br class="">})</div><div class=""><br class=""></div><div class="">Which aside from being a brain teaser how to properly maintain ordering when $0.0's lastName != nil &amp;&amp; $0.1's lastName == nil, adds additional few lines.</div><div class=""><br class=""></div><div class="">But I agree that it may come as confusing with Ints, etc. - with strings it kind of makes sense since nil is like an empty string which is placed in front of everything.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 27, 2016, at 1:46 PM, Haravikk 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=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 27 Aug 2016, at 02:01, Kevin Ballard via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><div class=""><div class=""><br class="">This change is going to have a HUGE impact for me. I use this sort of comparison _all the time_ and find it incredibly useful, and have had literally zero bugs caused by this. Surely I can't be the only one who uses this. I am not looking forward to copying &amp; pasting a reimplementation of the comparison functions into every single project I work on.</div></div></blockquote><br class=""></div><div class="">Can you give some examples as to how this will have such a huge impact? Now that we have the ?? operator it seems that this is fairly easy to replace:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>value &lt; 5 // where value is of type Int?</font></div><div class=""><br class=""></div><div class="">With:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>(value ?? 0) &lt; 5</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><br class=""></div><div class="">The latter is completely clear what the behaviour of nil is.</div><div class=""><br class=""></div><div class="">Also, you can still re-add the operators where you need them, ideally with as limited a type as possible so you can make sure that it's behaviour is well defined.</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=""></div></body></html>