<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 19, 2015, at 1:41 PM, Dennis Lysenko &lt;<a href="mailto:dennis.s.lysenko@gmail.com" class="">dennis.s.lysenko@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><p dir="ltr" class="">Shadowing is good in this case because it lets you capture constant values for the exact scope in which you need them.</p></div></blockquote><div>That is completely independent of shadowing. &nbsp;You do that even if you choose different names inside the block from outside.</div><blockquote type="cite" class=""><div class=""><p dir="ltr" class="">This helps avoid overhead of repeated getters and method calls. Using shorter names is automatically less descriptive; otherwise, people would advocate using abbreviations in property names, which is a stylistic and readability faux pas. </p></div></blockquote><div>"More descriptive" ≠ "more readable". &nbsp;When writing, we don't go into reams of detail about everything; we go into detail about the salient things. &nbsp;We have pronouns for a reason, e.g. "when a person arriving at the refrigerator opens the door, <u class="">she</u> sees what's inside; then <u class="">she</u> decides whether <u class="">she</u> wants it." &nbsp;"She" is a short name used in a localized context as a stand-in for a more-descriptive phrase, "a person arriving at the refrigerator". &nbsp;Repeating the more descriptive phrase would harm readability.</div><div><br class=""></div><blockquote type="cite" class=""><div class="">
<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Sat, Dec 19, 2015, 4:34 PM&nbsp;Dennis Lysenko &lt;<a href="mailto:dennis.s.lysenko@gmail.com" class="">dennis.s.lysenko@gmail.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr" class="">Disagree. Short names are less descriptive and less readable. And saying "shadowing is bad" without any argument is just silly for a mailing list. </p>
<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Sat, Dec 19, 2015, 3:57 PM&nbsp;Dave Abrahams via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 19, 2015, at 12:37 PM, ilya via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;white-space:pre-wrap" class="">I prefer <br class=""><br class="">if let vc = someInterestingViewConroller {<br class="">  vc.doSomething()<br class="">}<br class=""><br class="">- Explicit is better than implicit<br class="">- shadowing is bad <br class="">- now there's no ambiguity about how to change the original property. <br class=""><br class="">Therefore I'm -1 on any proposal that hides explicit name binding and/or increases shadowing, including let foo and unwrap foo. <br class=""></div></div></blockquote><div class=""><br class=""></div></div></div><div style="word-wrap:break-word" class=""><div class="">+1 to that.&nbsp; IMO re-using the same name for the unwrapped version of an optional variable does not help readability, and I don't want to encourage it.&nbsp; In a localized context like this, a short name is often better anyway as it declutters the code inside the block.</div></div><div style="word-wrap:break-word" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class="gmail_quote" style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div dir="ltr" class="">On Sat, Dec 19, 2015 at 21:31 Kevin Wooten via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><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 dir="auto" class=""><div class="">As much fun as it to example with foo, I would argue the opposite when you use some real world variable names:</div><div class=""><br class=""></div><div class="">if let someInterestingViewConroller =<span class="">&nbsp;</span><span style="background-color:rgba(255,255,255,0)" class="">someInterestingViewConroller {</span></div><div class=""><span style="background-color:rgba(255,255,255,0)" class="">}</span></div><div class=""><br class=""></div><div class="">vs</div><div class=""><br class=""></div><div class="">If let&nbsp;<span style="background-color:rgba(255,255,255,0)" class="">someInterestingViewConroller {</span></div><div class="">}</div><div class=""><br class=""></div><div class="">We know what let does and it should be enough to impart the necessary information for this statement.</div><div class=""><br class=""></div><div class="">When it comes to newcomers I think you'd be hard pressed to find somebody who'd be able to understand either form without teaching; so not losing much there.<br class=""><br class=""></div></div><div dir="auto" class=""><div class=""><br class="">On Dec 19, 2015, at 10:01 AM, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 11, 2015, at 8:19 AM, Jeff Kelley via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class="">I’ve had similar ideas to this. Instead of ditching the<span class="">&nbsp;</span><font face="Menlo" class="">if let</font><span class="">&nbsp;</span>syntax altogether, another approach would be to use the existing name if no new name is given, so that this code:<div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span style="white-space:pre-wrap" class="">        </span>if let foo = foo { /* use foo */ }</font></div><div class=""><br class=""></div><div class="">could become this code:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span style="white-space:pre-wrap" class="">        </span>if let foo { /* use foo */ }</font></div><div class=""><br class=""></div><div class="">In both cases,<span class="">&nbsp;</span><font face="Menlo" class="">foo</font><span class="">&nbsp;</span>is non-optional inside the braces. If you gave it another name with the<span class="">&nbsp;</span><font face="Menlo" class="">if let</font><span class="">&nbsp;</span>syntax, that would work as it does today.<br class=""></div></div></div></blockquote><br class=""></div><div class="">Hi Jeff,</div><div class=""><br class=""></div><div class="">This is commonly requested - the problem is that while it does help reduce boilerplate, it runs counter to the goal of improving clarity.</div><div class=""><br class=""></div><div class="">-Chris</div><br class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=1Ry8ov4zuU66O51YNcjYWXuMGf2gObG8uPwoJz-2B4Z1VqMdeyeesw-2Bc9SDkZTEmLmnofSO3tNgiMGF47sxE879Ut5x-2F6sLSrTgmZhXJOq-2B59bEaSmJ0a44hp5limyi-2FpsrcKvySjRuPP0gLr6FoeZNJoisevK-2BimrVdnhvmWcLj69rx67MHqizgTcdJrprVSbV2f-2FkGqilX9aSsmL60yEZg-3D-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important" class=""></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=1p9Jer2O6jVE9KWvo-2B9iUaEyN8slp4IizyiLwsfp54MtyOWrxaoHaMGzAhnPMF0sp5LxPZXk5eNlBjxy-2FAt5zkVbo2VD-2FQ4W-2BUOuGoaft-2FplxC7EKcDRU0CihWEShk8inzqrtA1U88maK5c2nA9GWIyomaiD9Fdm9Rv0pxi-2BRLreE13nSbY2-2BiUb-2BzelAVPA9sLs0wsXjhNwG2RMjUwV9g2oowx9vB6BgEzO0DKOI-2BM-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important" class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></blockquote></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=JfMPa-2F7wwZPzsZ3QKA8NjtONIYX4SjbWuUxtpfsTY2hXedcyq5lkDMFuqNI-2FTYM60ihjikmscX8M3ZWEMSkdUkX05raM9I4R3R-2FHyFe3G2N3ShP5gnuZ4v9E-2Fu53eu6K0JUYD-2FQs4hRoc0-2BZzgPfjjqPyrJ-2BlIG98aa8-2BHgIqDapk-2BzusDVZ8RtNIvNilt8B8DCCwD4pASKA7Ufschn4uVODQzqxiMJRfWykP9LNHH4-3D" alt="" width="1" height="1" border="0" style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important" class=""><span style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class=""><span class="">&nbsp;</span>_______________________________________________</span><br style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">swift-evolution mailing list</span><br style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><a href="mailto:swift-evolution@swift.org" style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" class="">swift-evolution@swift.org</a><br style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:AvenirNext-Regular;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div><div style="word-wrap:break-word" class=""><div class="">
-Dave<div class=""><br class=""></div><br class="">

</div>
<br class="">
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=8CZIdLciSFC-2BO5jF-2FiP8qN7dBFsgCUZ50wdTsolcRPdTVS8Tw54Ep55nuvbPV-2FtPEBf3SpXw53WO9uWKD6AYrvrvJk0EHXo9p-2BnyhXVuIR2pddjfK4kVdKZORb1dht-2BV40k-2FGPK1AWr0GoC8-2F1RvYwIGiBv15Kl9S2H91lQ-2Fso14CWTqtyiwSekH927TQndK-2BG9ukAyaCgXSc4wT6TNECUp8iL9sKHnmpRP4pF5WZFQ-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important" class="">
</div>
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div></blockquote></div>
</div></blockquote></div><br class=""><div class="">
-Dave<div class=""><br class=""></div><br class="Apple-interchange-newline">

</div>
<br class=""></body></html>