<div dir="ltr">Agreed — or, I think, these operators could/should simply be removed.<div><br></div><div>I filed &lt;rdar://22833869&gt; about this a while ago, which was marked as Duplicate/&lt;rdar://16966712&gt;.</div><div><br></div><div><pre style="outline:none;font-family:inherit;font-size:13px;margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;color:rgb(0,0,0)"><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote">Summary:<br>This returns true:
    (nil as Int?) &lt; 0
This also returns true, which makes even less sense:
    (nil as Int?) &lt; Int.min<span style="font-family:inherit"> </span></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote">Expected Results:<br>nil &lt; 0, nil &gt; 0, and nil == 0, should all be false. nil != 0 should be true.
Alternatively, just *don&#39;t* provide &lt; and &gt; operators that accept optional arguments.<span style="font-family:inherit"> </span></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote"><span style="font-family:inherit"> </span></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote">Actual Results:<br>nil &lt; 0 is true. Others are as expected.</blockquote><div><br></div><div>See also: <a href="https://twitter.com/jtbandes/status/646914031433871364">https://twitter.com/jtbandes/status/646914031433871364</a> </div></pre></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Thu, Dec 3, 2015 at 3:42 PM, Amir Michail <span dir="ltr">&lt;<a href="mailto:a.michail@me.com" target="_blank">a.michail@me.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Such comparisons with optionals can result in hard to find bugs.<br>
<br>
For example consider:<br>
<br>
let f = x &lt; 5  // x is of type Int? and may be nil<br>
<br>
The proposed ? suffix would be used as follows and makes the possibility of nil very clear:<br>
<br>
let f = x? &lt; 5<br>
<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div><br></div></div>