<div dir="ltr">Escaping self with back-ticks is an intriguing workaround for this. However, I think escaping keywords with back-ticks for anything other than avoiding interop naming issues should be considered an antipattern.<div><br></div><div>Allowing &quot;guard let self = self else { return }&quot; makes a lot of sense to me.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 6, 2016 at 1:18 PM, Paul Cantrell via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>But “self” _is_ a reserved word, and that’s the whole reason that this proposal is necessary in the first place. If “self” were just a normal identifier, then “if let self = self” would work just as well as “if let foo = foo” and there would be nothing to discuss.</div><div><br></div><div><span class=""><blockquote type="cite"><div dir="ltr"><div><div>The docs also say &quot;The backticks are not considered part of the identifier; `x` and x have the same meaning.&quot; Thus `self` and self should have the same meaning.</div></div></div></blockquote><div><br></div></span><div>Well, `flurtzle` and flurtzle would have the same meaning, but `self` is an identifier whereas as self is a keyword, so they mean different things. That is precisely what the backticks are for.</div><span class=""><br><blockquote type="cite"><div dir="ltr"><div><div>Assigning to `self` is the same as assigning to self, which intentionally isn&#39;t allowed.</div></div></div></blockquote><br></span></div><div>No, you’re creating a new identifier called “self” which shadows the old one.</div><div><br></div><div>Consider this:</div><div><br></div><div><div style="margin:0px;font-size:10.5px;line-height:normal;font-family:Menlo">    <span style="color:#323e7d">let</span> foo: <span style="color:#587ea8">Int</span>? = <span style="color:#323e7d">7</span></div><div style="margin:0px;font-size:10.5px;line-height:normal;font-family:Menlo;min-height:12px"><span style="font-size:10.5px">    </span><span style="font-size:10.5px;color:rgb(50,62,125)">if</span><span style="font-size:10.5px"> </span><span style="font-size:10.5px;color:rgb(50,62,125)">let</span><span style="font-size:10.5px"> foo = </span><span style="font-size:10.5px;color:rgb(88,126,168)">foo</span><span style="font-size:10.5px"> {</span></div><div style="margin:0px;font-size:10.5px;line-height:normal;font-family:Menlo">        <span style="color:#587ea8">print</span>(foo + <span style="color:#323e7d">1</span>)</div><div style="margin:0px;font-size:10.5px;line-height:normal;font-family:Menlo">    }</div></div><div><br></div><div>There are two identifiers named foo, one optional, one not. Both are declared with “let”, so neither can be assigned to. But the code works. Why? Because “let foo = foo” doesn’t assign to the outer variable; it creates a new one. If self were not a keyword, then it would work the same as “foo” above.</div><div><br></div><div>Cheers,</div><div><br></div><div>Paul</div><div><br></div><br><div><blockquote type="cite"><div><div class="h5"><div>On Jan 6, 2016, at 2:56 PM, Jacob Bandes-Storch via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr">Not exactly; backticks are for making an identifier out of something that&#39;s not normally an identifier. Most other reserved words are used in control flow &amp; other declarations. Rarely do they actually represent identifiers/values that you can work with.<div><div><br></div><div>The docs also say &quot;The backticks are not considered part of the identifier; `x` and x have the same meaning.&quot; Thus `self` and self should have the same meaning. Assigning to `self` is the same as assigning to self, which intentionally isn&#39;t allowed. Backticks shouldn&#39;t allow you to circumvent that.</div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Wed, Jan 6, 2016 at 12:50 PM, Paul Cantrell <span dir="ltr">&lt;<a href="mailto:paul@innig.net" target="_blank">paul@innig.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Ummm … isn’t that _exactly_ what backticks are for? From the docs:</div><div><br></div><div><span style="color:rgb(65,65,65);font-family:Helvetica,Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">    To use a reserved word as an identifier, put a backtick (</span><code style="border:0px;font-size:0.85em;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(128,128,128);font-family:Menlo,monospace;word-wrap:break-word">`</code><span style="color:rgb(65,65,65);font-family:Helvetica,Arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">) before and after it.</span></div><div><br></div><br><div><blockquote type="cite"><div><div><div>On Jan 5, 2016, at 10:42 PM, Greg Parker via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br></div></div><div><div style="word-wrap:break-word"><div><div><div>I think it is a bug  :-)  That&#39;s not what backquotes are for. It ought to be either supported without the backquotes or banned regardless of backquotes. </div><br><div><blockquote type="cite"><div>On Jan 5, 2016, at 8:34 PM, Jacob Bandes-Storch &lt;<a href="mailto:jtbandes@gmail.com" target="_blank">jtbandes@gmail.com</a>&gt; wrote:</div><br><div><div dir="ltr">Yes, it seems to use the strong shadowing variable. (The compiler doesn&#39;t complain about &quot;self.foo&quot;, and &quot;self?.foo&quot; becomes invalid because self is no longer optional.)<div><br></div><div>If it weren&#39;t so useful, I&#39;d call it a bug.<br><div class="gmail_extra">
<br><div class="gmail_quote">On Tue, Jan 5, 2016 at 8:34 PM, Greg Parker <span dir="ltr">&lt;<a href="mailto:gparker@apple.com" target="_blank">gparker@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Does further use of self after that actually use a strong shadowing variable? Or does it go back to the weak reference it already had as if the shadow were not there?</div><span><div><br></div><div><blockquote type="cite"><div>On Jan 5, 2016, at 8:26 PM, Jacob Bandes-Storch via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div dir="ltr">Wow! I didn&#39;t know that worked. It&#39;s a bit surprising, and perhaps not intended. I think the proposal is still valid.<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 5, 2016 at 8:21 PM, Christopher Rogers <span dir="ltr">&lt;<a href="mailto:christorogers@gmail.com" target="_blank">christorogers@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You can shadow self with a guard like you wrote it if use the keyword escaping backquotes like so:<br><br>guard let `self` = self else { return }</blockquote></div></div></div></div></blockquote></div></span></div></blockquote></div></div></div></div></div></blockquote></div><br>
</div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=zCg-2FSGF9Wk188a6c55kLyEbrj7YhaXxFEHM-2F-2B0YAlzVd6mytc-2Bot4Nm0jCNAgoJQ9HD-2FdukApss0YvDHJVDga5JqX24xJKIBtSZZPdEpFRoxNQNHIojDDiWTjpRnu1FoNIrWUaH-2FfgGg4R-2BxhI1xHLGfmei8pcxFhZjUQ3tfKNrJDTLFWYVsIcJw8NTo-2B3Ktg4QOrmww9PmlDmkGobNutJFnEnBs3pBkJ0W9j9TJWms-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">
</div><span>
_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></span></div></blockquote></div><br></div></blockquote></div><br></div></div></div>
</div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=zCg-2FSGF9Wk188a6c55kLyEbrj7YhaXxFEHM-2F-2B0YAlzWxEnWvfi7JA5i1QSLdy7u-2B64k93tOKY6Y5nQcjiA1EuLXXpvTcCsJDo7kgQqLaQoIoJWE-2FmFb1dY3gwwhyP-2Bp1Ac-2BrvViJjIYhbyvJKZ-2FMxjf8aRQEAc8-2BhzfzGxmvL9wzPF74Stdord0Fp-2Fw6sdp4lOh2lr7dDdpzY0lcf7iKJpQIGmAe0297EFIldfhtwYs-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">
_______________________________________________<span class=""><br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></span></div></blockquote></div><br>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=jcsQZDjngJCzOht1jfuLFUafDYRFGiKkaTW3jS9rsrfd6dT4k87QdtnvQL3VDRIIroI-2BcbgcD-2FyGgvv6WXadZxZcaVFqgRMKWnDIq0B5EVUoHW75E67MXy0YLbtsAqVV5E-2BbGKt9QhJaK-2B9l2ys8eqREZai-2FC8ZXT-2B4MhdKGSoiBeFREi90VlhoF-2F80qhy1mTP47RVCdFBLd4HNPb-2FYS9-2FeF4wiwvXxe3YwpUnYQjls-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">
</div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><br></div><div><div dir="ltr" style="font-size:12.8000001907349px"><b style="font-size:small;background-color:transparent"><span style="color:rgb(53,217,144)"><font face="arial, helvetica, sans-serif">Alex Johnson</font></span><font color="#666666"> | Engineering Lead</font></b></div><div dir="ltr" style="font-size:12.8000001907349px"><b style="font-size:12.8000001907349px"><font color="#666666"><br></font></b></div><div dir="ltr" style="color:rgb(68,68,68);font-family:Arial,Verdana,sans-serif;font-size:12.8000001907349px"><div style="font-family:arial,sans-serif;color:rgb(34,34,34);font-size:12.8000001907349px"><b style="font-family:Arial;font-size:small;line-height:14.9499998092651px;white-space:pre-wrap"><a href="https://quickleft.com/" style="color:rgb(0,51,204)" target="_blank"><font color="#000000">Quick Left, Inc.</font></a></b></div><div style="font-family:arial,sans-serif;color:rgb(34,34,34);font-size:12.8000001907349px"><span style="color:rgb(0,0,0);font-family:Arial;white-space:pre-wrap;line-height:1.15;font-size:small;background-color:transparent"><b>Boulder </b></span><span style="font-size:12.8000001907349px"><font color="#999999"><b>|</b></font></span><b style="color:rgb(0,0,0);font-family:Arial;font-size:small;line-height:1.15;white-space:pre-wrap;background-color:transparent"> </b><b style="color:rgb(0,0,0);font-family:Arial;font-size:small;line-height:1.15;white-space:pre-wrap;background-color:transparent">Denver</b><font color="#999999" style="font-size:12.8000001907349px;background-color:transparent"><b style="font-family:Arial;font-size:small;line-height:1.15;white-space:pre-wrap;background-color:transparent"> </b><span style="font-size:12.8000001907349px"><b>|</b></span></font><b style="color:rgb(0,0,0);font-family:Arial;font-size:small;line-height:1.15;white-space:pre-wrap;background-color:transparent"> </b><b style="color:rgb(0,0,0);font-family:Arial;font-size:small;line-height:1.15;white-space:pre-wrap;background-color:transparent">Portland</b><font color="#999999" style="font-size:12.8000001907349px;background-color:transparent"><b><span style="font-family:Arial;font-size:small;line-height:1.15;white-space:pre-wrap;background-color:transparent"> </span><span style="font-size:12.8000001907349px">|</span></b></font><b style="color:rgb(0,0,0);font-family:Arial;font-size:small;line-height:1.15;white-space:pre-wrap;background-color:transparent"> San Francisco</b></div><div><font style="font-size:12.8000001907349px"><p style="line-height:1.15;font-size:12.8000001907349px;margin-top:0pt;margin-bottom:0pt"><span style="color:rgb(102,102,102);font-family:arial,sans-serif;font-size:12.8000001907349px;line-height:normal;background-color:transparent">1 (844) QL-NERDS</span></p><p style="font-size:12.8000001907349px;margin-top:0pt;margin-bottom:0pt"><font color="#666666" face="arial, sans-serif">@nonsensery</font></p><p style="font-family:arial,sans-serif;color:rgb(34,34,34);margin:0px"><br></p></font><p dir="ltr" style="line-height:1.15;font-size:12.8000001907349px;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><a href="https://github.com/quickleft" style="color:rgb(0,51,204)" target="_blank"><img src="http://i.imgbox.com/MNlkdRf3.png" style="border:0px;padding:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8000001907349px;line-height:normal;white-space:normal;vertical-align:middle!important" alt=""></a><a href="https://www.facebook.com/quickleft" style="color:rgb(0,51,204)" target="_blank"><img src="http://i.imgbox.com/mZ3v7rXp.png" style="border:0px;padding:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8000001907349px;line-height:normal;white-space:normal;vertical-align:middle!important" alt=""></a><a href="https://twitter.com/quickleft" style="color:rgb(0,51,204)" target="_blank"><img src="http://i.imgbox.com/C2qj69cx.png" style="border:0px;padding:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8000001907349px;line-height:normal;white-space:normal;vertical-align:middle!important" alt=""></a><a href="https://instagram.com/quick_left/" style="color:rgb(0,51,204)" target="_blank"><img src="http://i.imgbox.com/3kcv532Y.png" style="border:0px;padding:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8000001907349px;line-height:normal;white-space:normal;vertical-align:middle!important" alt=""></a><a href="https://www.flickr.com/photos/quickleft" style="color:rgb(0,51,204)" target="_blank"><img src="http://i.imgbox.com/qrtOZXDo.png" style="border:0px;padding:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8000001907349px;line-height:normal;white-space:normal;vertical-align:middle!important" alt=""></a><a href="https://vimeo.com/quickleft" style="color:rgb(0,51,204)" target="_blank"><img src="http://i.imgbox.com/lv7fDapY.png" style="border:0px;padding:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8000001907349px;line-height:normal;white-space:normal;vertical-align:middle!important" alt=""></a></span></p><p dir="ltr" style="line-height:1.15;font-size:12.8000001907349px;margin-top:0pt;margin-bottom:0pt"><br></p><p dir="ltr" style="line-height:1.15;font-size:12.8000001907349px;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><font size="2"><a value="+13032425536" style="color:rgb(17,85,204);text-decoration:underline"></a></font></span></p><div style="font-family:arial,sans-serif"><span style="vertical-align:baseline;white-space:pre-wrap"><span style="color:rgb(53,217,144)"><font face="arial, helvetica, sans-serif" size="2"><b>What&#39;s it like to work with us? </b></font></span><font style="font-size:12.8000001907349px;font-family:Arial"><i style="color:rgb(0,0,0);font-family:arial,sans-serif;white-space:normal">TrainingPeaks, iTriage, and Ping Identity share their stories in this short video</i><i style="font-family:arial,sans-serif;white-space:normal"><font color="#500050"> </font><a href="https://vimeo.com/92286352" style="color:rgb(0,51,204)" target="_blank"><font color="#666666">A Client&#39;s View</font></a></i><span style="font-family:arial,sans-serif;white-space:normal"><font color="#666666">.</font></span></font></span></div></div></div></div></div></div></div></div>
</div>