<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="">Pulling &amp; updating my comments from the old thread:</div><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 1, 2016, at 1:18 PM, Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">The <font face="Menlo" class="">if let x = x {...}</font> and <font face="Menlo" class="">guard let x = x else {...}</font> constructs do something with&nbsp;<font face="Menlo" class="">let</font> (and&nbsp;<font face="Menlo" class="">var</font>) that's fundamentally different from <font face="Menlo" class="">let</font> (and <font face="Menlo" class="">var</font>) elsewhere in the language.</div></div></div></div></blockquote><div><br class=""></div><div>I don’t agree. Wherever they appear, let and var declare a new variable. And they always shadow variables from an outer scope in exactly the same way:</div><div><br class=""></div><div><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;&nbsp;<span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">let</span> x = <span style="font-variant-ligatures: no-common-ligatures; color: #843e64" class="">"hi"</span></div><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">if</span> <span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">3</span> &lt; <span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">7</span> {</div><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo; color: rgb(132, 62, 100);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> x = [</span>"different"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, </span>"scope"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, </span>"different"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, </span>"x"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">]</span></div><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">print</span>(x)</div><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div><div><br class=""></div><div>This consistency of meaning for let/var gives the correct implication: “if let” is just a normal variable declaration, even though it appears in the middle of an if condition.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">The same keywords are used to conditionally unwrap</div><div class="">and bind an item, not just shadow that item's current value.</div></div></div></div></blockquote></div><br class=""><div class="">In my head, it’s “if”, not “let”, that conveys the conditionality. Really, “if” + “let” is exactly the right combination of concepts; the words just come in a grammatically confusing order.</div><div class=""><br class=""></div><div class="">To me, “bind” misleadingly implies that this is something <i class="">other</i> than a normal variable declaration: maybe an alias, or a reactive binding, or something like that.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class=""><br class=""></div><div class="">Paul</div><div class=""><br class=""></div></body></html>