<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="">Yes, but they don't unwrap. Which is the extra something special.</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">if let x = x {...} </font></div><div class=""><br class=""></div><div class="">is kind of really </div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">x.map({f(x)}) // Bless you Kevin!</font></div><div class=""><br class=""></div><div class="">if you follow what I'm saying. It's not just binding.</div><div class=""><br class=""></div><div class="">-- E</div><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 1, 2016, at 2:52 PM, Paul Cantrell <<a href="mailto:cantrell@pobox.com" class="">cantrell@pobox.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Pulling & updating my comments from the old thread:</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 1, 2016, at 1:18 PM, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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 <font face="Menlo" class="">let</font> (and <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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;" class=""> <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=""> <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> < <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="" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #323e7d" class="">let</span><span style="" class=""> x = [</span>"different"<span style="" class="">, </span>"scope"<span style="" class="">, </span>"different"<span style="" class="">, </span>"x"<span style="" class="">]</span></div><div style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;" class=""> <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=""> }</div></div><div class=""><br class=""></div><div class="">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></div></div></blockquote></div><br class=""></body></html>