<p dir="ltr">What if we made the keyword "unwrap"? </p>
<p dir="ltr">if unwrap someViewController {<br>
// now there is a shadowing nonoptional (unwrapped) variable of the same name only within this scope, boiling down to simple syntactic sugar for optional binding and it is fairly clear. <br>
} </p>
<br><div class="gmail_quote"><div dir="ltr">On Sat, Dec 19, 2015, 1:31 PM Kevin Wooten via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>As much fun as it to example with foo, I would argue the opposite when you use some real world variable names:</div><div><br></div><div>if let someInterestingViewConroller = <span style="background-color:rgba(255,255,255,0)">someInterestingViewConroller {</span></div><div><span style="background-color:rgba(255,255,255,0)">}</span></div><div><br></div><div>vs</div><div><br></div><div>If let <span style="background-color:rgba(255,255,255,0)">someInterestingViewConroller {</span></div><div>}</div><div><br></div><div>We know what let does and it should be enough to impart the necessary information for this statement.</div><div><br></div><div>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><br></div></div><div dir="auto"><div><br>On Dec 19, 2015, at 10:01 AM, Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><br><div><blockquote type="cite"><div>On Dec 11, 2015, at 8:19 AM, Jeff Kelley via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div style="word-wrap:break-word">I’ve had similar ideas to this. Instead of ditching the <font face="Menlo">if let</font> syntax altogether, another approach would be to use the existing name if no new name is given, so that this code:<div><br></div><div><font face="Menlo"><span style="white-space:pre-wrap">        </span>if let foo = foo { /* use foo */ }</font></div><div><br></div><div>could become this code:</div><div><br></div><div><font face="Menlo"><span style="white-space:pre-wrap">        </span>if let foo { /* use foo */ }</font></div><div><br></div><div>In both cases, <font face="Menlo">foo</font> is non-optional inside the braces. If you gave it another name with the <font face="Menlo">if let</font> syntax, that would work as it does today.<br></div></div></div></blockquote><br></div><div>Hi Jeff,</div><div><br></div><div>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><br></div><div>-Chris</div><br>
<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: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></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=8CZIdLciSFC-2BO5jF-2FiP8qN7dBFsgCUZ50wdTsolcRPcpzoe4iXPbeaZqrNi2zUlVcdf23NokhHdJZryR37S9aixDNF6tp-2FHf6-2F3lVQio0UE9CBtzVmsMnWQIwW5-2Bf67ND-2F9EF-2BYtV4PpGh922HX58TP5zyNp5Y5ztlmKYymIqTstHghNX4ILNRx0CI2Vk86QzONhMNmZj19pTNa6dGACoMcZLny6tVt4eUiRGI6oOyI-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>
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" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>