<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <br> <div id="bloop_sign_1491934987204692992" class="bloop_sign"></div> <br><p class="airmail_on">On April 11, 2017 at 11:38:05 AM, Joe Groff (<a href="mailto:jgroff@apple.com">jgroff@apple.com</a>) wrote:</p> <div><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span><div><span style="color: rgb(0, 0, 0); font-family: 'helvetica Neue', helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none; display: inline !important;">By design, Swift avoids making semantic rules based on that kind of analysis, since it would be brittle and difficult to describe when the compiler can and can't see that a condition holds nonlocally like this.</span></div></span></blockquote></div><p>Swift *currently implements* semantic rules based on this kind of analysis. &nbsp;Exhibit A:</p><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><p>func foo() {</p><p>&nbsp; &nbsp; let a: Bool</p><p>&nbsp; &nbsp; if UUID().uuidString == "non-local condition" {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; a = true</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; else {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; preconditionFailure("Don't initialize a")</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; print("\(a)") //NOT: error: a is uninitialized</p><p>}</p></blockquote><div></div></body></html>