<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div>Vladimir,</div><div><br class=""></div><div>I don't disagree with you about bitwise operations (please read my email again). I'm saying when it comes to `<span style="font-family: Menlo;" class="">??</span>`, we don't have the evidence necessary for proposing a breaking change.</div><div><br class=""></div></div><div><blockquote type="cite" class=""><div class="">On 08 Sep 2016, at 14:21, Vladimir.S <<a href="mailto:svabox@gmail.com" class="">svabox@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Why do you need to see some precedence (…) while this construction is so simple and obviously would be used often and *will* cause bugs. (…)<br class=""></div></div></blockquote><div><br class=""></div><div>Let me put it differently: I still haven't seen, nor was I able to conceive myself, a <i class="">realistic</i> example where `<span style="font-family: Menlo;" class="">??</span>` would cause problems.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><blockquote type="cite" class="">The original motivation by Erica simply failed to compile (…)<br class=""></blockquote><br class="">Sorry, but you are just not right.</div></div></blockquote><div><br class=""></div><div>Let me remind you that the original motivation from Erica wasn't about which way `<font face="Menlo" class="">foundIndex ?? lastIndex + 1</font>` goes but about whether `<font face="Menlo" class=""><b class="">let</b> y = 5 + x ?? 2</font>` compiles at all.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">The code compiles without even warning:<br class=""><br class="">let foundIndex : Int? = 1<br class="">let lastIndex = 2<br class=""><br class="">let nextIndex = foundIndex ?? lastIndex + 1<br class=""></div></div></blockquote><div><br class=""></div><div>It certainly does compile. <b class="">But is it realistic?</b> Look at the variable names: does this code make any sense at all? What is `<font face="Menlo" class="">lastIndex</font>`? What is `<font face="Menlo" class="">lastIndex + 1</font>`? Why not `<font face="Menlo" class="">things.endIndex</font>`? Indeed, why not:</div><div><br class=""></div><div><font face="Menlo" class=""> <b class="">let</b> foundIndex: Int? = things.index(of: something)</font></div><div><font face="Menlo" class=""> <b class="">let</b> nextIndex = foundIndex.map { $0 + 1 } ?? things.endIndex</font></div><div><br class=""></div><div>That said, I give you the benefit of the doubt – I still believe there <i class="">can</i> be examples where `<font face="Menlo" class="">??</font>` may be confusing. But without seeing any such examples from the real world, I don't think we have a case for changing `<span style="font-family: Menlo;" class="">??</span>`.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class="">After I showed the code compiles, would you change your opinion?<br class=""></div></div></blockquote><div><br class=""></div><div>No, not with these examples.</div><div><br class=""></div><div>* * *</div><div><br class=""></div><div>Finally:</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">IMO the best solution (…) would be to require (…) parenthesis when operators from different groups are mixed in the same expression. IMO no need in complex rules to make Swift safer. I.e. when you have a = 10 + 5 * 10 - you don't need parenthesis, when you have a = b << 4 - also all is ok, but if you have a = b << 4 + 5 * 10 - you'll have a warning until add parenthesis to make your intention clear. (…)<br class=""></div></div></blockquote><div><br class=""></div><div>Look, changing how `<font face="Menlo" class="">b << 4 + 5 * 10</font>` is compiled is <b class="">exactly</b> what I was proposing. With my changes, it would become a compiler error. IMO, it ought to be parenthesised explicitly as either</div><div><br class=""></div><div><font face="Menlo" class=""> (b << 4) + 5 * 10</font></div><div><br class=""></div><div>or</div><div><br class=""></div><div><font face="Menlo" class=""> b << (4 + 5 * 10)</font></div><div><br class=""></div><div>depending on which one was intended.</div><div><br class=""></div><div>— Pyry</div><div><br class=""></div></div></body></html>