<div dir="ltr"><div>On Fri, Dec 4, 2015 at 1:03 AM, Amir Michail <span dir="ltr">&lt;<a href="mailto:a.michail@me.com" target="_blank">a.michail@me.com</a>&gt;</span> wrote:<br></div><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-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><br>
</span>I really don’t like having to put the ! suffix in boolean contexts:<br></blockquote><div><br></div><div><div>To be explicit:</div><div><br></div><div>    let a: Bool! = false</div><div><br></div><div>    if a == false { }  // Works as expected<br></div><div><br></div><div>    if !a { }  // Works as expected</div><div><br></div><div>    if a { }   // &quot;error: optional type &#39;Bool!&#39; cannot be used as a boolean; test for &#39;!= nil&#39; instead&quot;</div></div><div><br></div><div>Xcode &quot;fixes&quot; the last line like this:</div><div><br></div><div>    if (a != nil) { }<br></div><div><br></div><div><br></div><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">
<br>
&quot;if displayFlag! { ... }&quot; instead of &quot;if displayFlag { … }&quot; etc.<br>
<br>
If you also want a way to compare with nil, then maybe have this for implicitly unwrapped optionals:<br>
<br>
if displayFlag? == nil { … }<br>
<div><div>_______________________________________________<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>
</div></div></blockquote></div><br></div></div>