<p dir="ltr">Well that would break the pattern where you split the implementation of a type across several extensions in the same file.<br>
This is also often done when declaring protocol conformance to break down the type into logical pieces. <br>
I don't want to be forced to squeeze everything into the same body and declare a list of a dozen protocol conformance at once.</p>
<div class="gmail_quote">On Dec 14, 2015 19:10, "Matthew Johnson" <<a href="mailto:matthew@anandabits.com">matthew@anandabits.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Dec 14, 2015, at 11:58 AM, Marc Knaup <<a href="mailto:marc@knaup.koeln" target="_blank">marc@knaup.koeln</a>> wrote:</div><br><div><div dir="ltr">To sum up (what I understand) the new access modifier<div><ul><li>can be used only on type members (properties, methods, initializers, subscripts and nested types) - so not at file-level<br></li><li>grants access to that symbol to</li><ul><li>the containing type</li><li>(nested types)?</li><li>extension in the same file</li></ul><li>and does not grant access to</li><ul><li>extensions declared in a different file</li><li>subclasses</li><li>other locations in the same file as the ones granted above</li></ul></ul><div>Did I forget anything?</div></div></div></div></blockquote><br></div><div>This is *not* correct. It only grants access to other members declared within the same body. Some examples may help clarify the concept:</div><div><br></div><div>struct S {</div><div> // visible within the struct declaration only and *nowhere* else</div><div> scoped let foo: String</div><div><br></div><div> struct T {</div><div> // still within the scope of S so foo is still visible here</div><div> // buzz is only visible within the inner type, buzz is not visible to members of S</div><div> scoped let buzz: String</div><div> }</div><div>}</div><div><br></div><div>// in same file</div><div>extension S {</div><div> // foo is not visible here</div><div> // bar is visible only within the extension in which it is declared and *nowhere* else</div><div> scoped fun bar() -> String</div><div>}</div><div><br></div><div><br></div></div></blockquote></div>