<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="">Sorry if I've missed it, but I didn't see these comments addressed in a way that I thought was sufficient.</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 25, 2016, at 3:47 PM, Dave Abrahams 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=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The place where I'm most concerned about this is in playgrounds. If</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">we're going to use them to teach programming, it should be possible to</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">demonstrate encapsulation there.</span></div></blockquote></div><br class=""><div class="">Playgrounds support multiple files. Doesn't this alleviate this problem? Of course you can't model Swift's model in a single-file, but that's by-design. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""></div></div><blockquote type="cite" class=""><div class=""><div class="">On Jan 27, 2016, at 7:44 AM, Matthew Johnson 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=""><span class="" style="float: none; display: inline !important;">Aside from that, as has been noted several times, the most common need is “current scope only”. It would be nice if that could actually be expressed in the language. There are often valid reasons to organize code such that more than one scope exists in the same file without a desire to share implementation details between the scopes. Right now there is a tension between code layout and the visibility semantics we actually desire and intend.</span></div></div></blockquote><div class=""><span class="" style="float: none; display: inline !important;"><br class=""></span></div><div class=""><span class="" style="float: none; display: inline !important;">I disagree. You can pattern your code so that this appears to be the "most common need", but you can also pattern identical functioning code so that this feature doesn't even work.</span></div><div class=""><span class="" style="float: none; display: inline !important;"><br class=""></span></div><div class=""><span class="" style="float: none; display: inline !important;">For instance, I know in my code, this really isn't the "most common need". In fact, in nearly all of my code, local would be completely useless because I put the majority of my APIs in extensions. I like to model the data on the type definition and the APIs in extensions.</span></div><div class=""><span class="" style="float: none; display: inline !important;"><br class=""></span></div><div class=""><span class="" style="float: none; display: inline !important;">This proposal would make using extensions as a means of grouping functionality impossible:</span></div><div class=""><span class="" style="float: none; display: inline !important;"><br class=""></span></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><span class="" style="float: none; display: inline !important;"><font face="Menlo" class="">struct Foo {</font></span></div><div class=""><span class="" style="float: none; display: inline !important;"><font face="Menlo" class=""> local count: Int = 0</font></span></div><div class=""><span class="" style="float: none; display: inline !important;"><font face="Menlo" class="">}</font></span></div><div class=""><span class="" style="float: none; display: inline !important;"><font face="Menlo" class=""><br class=""></font></span></div><div class=""><span class="" style="float: none; display: inline !important;"><font face="Menlo" class="">extension Foo {</font></span></div><div class=""><span class="" style="float: none; display: inline !important;"><font face="Menlo" class=""> func hidden() { count += 1 } // error: count is not visible</font></span></div><div class=""><span class="" style="float: none; display: inline !important;"><font face="Menlo" class="">}</font></span></div></blockquote><div class=""><span class="" style="float: none; display: inline !important;"><br class=""></span></div><div class=""><span class="" style="float: none; display: inline !important;">So now we have to arbitrarily make `count` private, move `hidden()` into the `Foo` definition, or make `local` a whole lot more complicated.</span></div><div class=""><span class="" style="float: none; display: inline !important;"><br class=""></span></div><div class=""><span class="" style="float: none; display: inline !important;">If you design and write your code like you do in other languages, then ok, I can see a margin of usefulness from `local`. </span></div><div class=""><span class="" style="float: none; display: inline !important;"><br class=""></span></div><div class=""><span class="" style="float: none; display: inline !important;">-David</span></div></body></html>