<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> * What is your evaluation of the proposal?<br></blockquote><div><br></div><div>+1. Agree the comparison can be surprising, and it also confuses some people trying to understand optionals, apparently; I once couldn't convince someone how it worked until shortly afterwards for another issue @jckarter phrased it "Optional defines an ordering for itself with nil < everything." (<a href="https://twitter.com/jckarter/status/657266671703359488" target="_blank">https://twitter.com/jckarter/status/657266671703359488</a> ) That Optional defines an ordering for itself also emphasizes that nil < everything is arbitrary. </div><div><br></div><div>I think the question of the proposal is exactly "what remains is to decide whether these semantics (that nil is "less than" any non-nil value) are actually useful and worth keeping." </div><div><br></div><div>The Pet example shows how an asymmetry is caused: If someone wanted to filter people who don't have pets under 6 (so nil would be grouped with the higher numbers), the comparison operator is not useful without further logic-- but not when checking for people who don't have pets over 6 (nil grouped with the lower numbers). </div><div><br></div><div>In an another example, it's possible when ordering a list, all nil examples should be considered greater than, so that for example in an alphabetized list nil values should appear at the end of the list. </div><div><br></div><div><div>It's intuitive that nil is less than everything, but in plenty of scenarios that isn't useful. </div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
* Is the problem being addressed significant enough to warrant a change to Swift?<br></blockquote><div><br></div><div>Yes. Often where these are currently used, as in the proposal examples, the results can be surprising and not useful. </div><div><br></div><div>-MikeSand</div></div></div></div>