<div dir="ltr">On Sat, Dec 5, 2015 at 2:35 AM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></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="">On Dec 4, 2015, at 5:00 PM, Per Melin <<a href="mailto:p@greendale.se" target="_blank">p@greendale.se</a>> wrote:<br><div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><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?) -> Bool {</div><div> return i < 0</div><div>}</div></div><div><br></div><div>(No, I have never actually written code like this. I can't tell how likely it is that I would make this mistake.)</div></div></div></div></div>
</div></blockquote><br></div></span><div>This is a separate problem. One of the things we plan to discuss (once things settle down a bit) is how to narrow the implicit conversion from T to T? in cases like this. This implicit promotion, as well as the T <-> T! promotions are problematic in a number of ways, and we need a holistic solution to them.</div></div></blockquote><div><br></div><div><div>I noticed that the promotion is recursive.</div><div><br></div><div> let n: Int??? = 0</div><div> true ? 4711 : n // => Optional(Optional(Optional(4711)))</div><div><br></div><div>Implicit promotions aside, what is the strong case for even having (T?, T?) variants of the non-equatable comparable operators? I can see the convenience when sorting optionals, but I must be missing something else?</div><div><br></div><div>Once everyone gets the bikeshedding over syntax out of their system, hopefully the discussion can focus on more fundamental issues.</div><div><br></div></div></div></div></div>