<div dir="ltr">On Sat, Dec 5, 2015 at 1:04 AM, Chris Lattner <span dir="ltr">&lt;<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>&gt;</span> wrote:<br><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"><div style="word-wrap:break-word"><span class=""><br><div><blockquote type="cite"><div>On Dec 4, 2015, at 1:18 PM, Per Melin &lt;<a href="mailto:p@greendale.se" target="_blank">p@greendale.se</a>&gt; wrote:</div><div><div dir="ltr"><div><br></div><div class="gmail_extra"><div class="gmail_quote"><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></div></div></div></blockquote><br></div></span><div>Huh ok.  Out of curiosity, why are you using IUOs for this?</div></div></blockquote><div><br></div><div><div>I will leave that question to Amir who created this thread. I try to avoid IUOs altogether. I only found the above when trying to figure out what the heck he was talking about.</div><div><br></div><div> </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"><div style="word-wrap:break-word">I’m interested in (continuing to ) dramatically reduce the prevalence of IOUs in code (eliminating the need to use them), and reduce their power in various ways.  IUOs are one of the biggest sources of surprising behavior in Swift, and while they were a necessary feature to start with, their importance is going down over time.</div></blockquote><div><br></div><div>What surprised me was the IIUOs. I did not expect Swift to happily help me shoot myself in the foot quite so easily as this.<br></div><div><br></div><div><div>func isNegative(i: Int?) -&gt; Bool {</div><div>    return i &lt; 0</div><div>}</div></div><div><br></div><div>(No, I have never actually written code like this. I can&#39;t tell how likely it is that I would make this mistake.)</div><div><br></div></div></div></div></div>