<div dir="ltr">On Fri, Oct 6, 2017 at 7:07 PM Jose Cheyo Jimenez &lt;<a href="mailto:cheyo@masters3d.com">cheyo@masters3d.com</a>&gt; wrote:<br><div class="gmail_quote"><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><blockquote type="cite"><div>On Oct 6, 2017, at 11:07 AM, Tony Allevato &lt;<a href="mailto:tony.allevato@gmail.com" target="_blank">tony.allevato@gmail.com</a>&gt; wrote:</div><br class="m_5385757261706514487Apple-interchange-newline"><div><div dir="ltr" style="font-family:Helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote"><div dir="ltr">On Fri, Oct 6, 2017 at 10:16 AM Jose Cheyo Jimenez via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>On Oct 6, 2017, at 7:10 AM, Vladimir.S &lt;<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a>&gt; wrote:</div><br class="m_5385757261706514487m_736907767116209449Apple-interchange-newline"><div><div>On 05.10.2017 20:52, Jose Cheyo Jimenez via swift-evolution wrote:<br><blockquote type="cite"><blockquote type="cite">On Oct 5, 2017, at 4:32 AM, David Hart &lt;<a href="mailto:david@hartbit.com" target="_blank">david@hartbit.com</a>&lt;<a href="mailto:david@hartbit.com" target="_blank">mailto:david@hartbit.com</a>&gt;&gt; wrote:<br><br><blockquote type="cite"><br>On 5 Oct 2017, at 07:34, Jose Cheyo Jimenez via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br><br>I appreciate the enthusiasm but this is not a bug. This was a deliberate change in swift 3 to make `private extension` usable. If this was a bug then during swift 3 we should have disallowed `private extension` and only allowed `fileprivate extension` but that is not what happened. `private extension` has worked the same since swift 1. I’ve always used `private extension` when I want to add methods to String or other build in types.<span class="m_5385757261706514487Apple-converted-space"> </span><br></blockquote><br>It’s not a bug, but its unfortunate the behaviour wasn’t changed at the same time as SE-0169, and it now is very inconsistent. I also don’t have to rehash previous discussions, but if a Core Team member (Chris) is okay with going ahead with this, perhaps we should consider it.<br></blockquote>This could have not been part of 169 because it would&#39;ve required to lower the visibility of the private extension modifier.<br>“No migration will be necessary as this proposal merely broadens the visibility of|private|.”<br>There was a corner case mentioned when dealing with functions with the same name and that was understandable.<br>private extension is consistent to the way the private scope rules work. The word private is explicit at the top level because extensions can only be declared at top level. Top level private is always fileprivate. The inconsistency is that we have 1 scope ALC and the rest are not. An explicit declaration should always take precedence when declaring something like an access level override.<br></blockquote><br>FWIW, I can&#39;t agree with this. &#39;private extension&#39; is a real point of additional confusion for access levels in Swift.<br>Extension *by itself* has no access level, we only can specify the *default* (and the top most) access level for inner methods.<br>I.e. &#39;private&#39; access modifier for extension has not the same meaning as &#39;private&#39; func/type/variable at file scope.<br>(Yes, I also believe we should disallow &#39;private&#39; keyword at file level and allow it only for extensions, so &#39;fileprivate&#39; should be used explicitly if one needs this. At least warning should be raised. This is the *root* of the problem we discuss now. But unfortunately I don&#39;t expect this could be supported.)<br></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>Wouldn&#39;t that just add a<span class="m_5385757261706514487Apple-converted-space"> </span><u>special</u><span class="m_5385757261706514487Apple-converted-space"> </span>rule to extensions? :)</div><br><blockquote type="cite"><div><div></div></div></blockquote></div></div><div style="word-wrap:break-word"><div><blockquote type="cite"><div><div>The latter is &#39;direct&#39; access level for the func/type/variable and here we apply the standard rule for scoped private, so &#39;private&#39; for file scope --&gt; &#39;fileprivate&#39;.<br><br></div></div></blockquote></div></div><div style="word-wrap:break-word"><div><blockquote type="cite"><div><div>The former means &#39;the default(and top most) modifier that will be auto-inserted by compiler for all nested methods in extension&#39;. This relatively simple rule should not be complicated by additional rule as &quot;, but if it is private extension, result access level will be fileprivate, you can&#39;t have extensions with private methods”</div></div></blockquote><div><br></div><div>Private as it exist in swift now is the scope access control label. The compiler does not insert the modifier without having to first compute what access control level would be applied to the members of the extension.  Doing it the other way would be counterintuitive for an scope access label. In my code base I disallow top level fileprivate because private top level is fileprivate. This is a matter of taste and a linter here would help like a mentioned up thread.</div></div></div></blockquote><div><br></div><div>This is the sticking point, which is why there are two possible interpretations of &quot;private extension&quot;:</div><div><br></div><div>Choice 1) Attach-then-evaluate. &quot;ACL extension { ... }&quot; is a syntactic shortcut for &quot;extension { ACL ... }&quot;. Under that definition, the ACL is evaluated as if it were attached to each declaration, so &quot;private extension&quot; would expand to &quot;private&quot; in front of each decl.</div><div><br></div><div>Choice 2) Evaluate-then-attach. &quot;ACL extension { ... }&quot; is evaluated such that &quot;ACL&quot; takes on the meaning based on its scope; since it&#39;s equivalent to &quot;fileprivate&quot; there, that is what is attached to each declaration inside the extension.</div></div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div>Yep. This is the issue. Nice summary!</div></div><div style="word-wrap:break-word"><div><br><br><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote"><div>The phrasing in the official Swift language guide doesn&#39;t specifically state it, but I think most readers would interpret the following as #1:</div></div></div></div></blockquote><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote"><div><br></div><div>&quot;Alternatively, you can mark an extension with an explicit access-level modifier (for example, `private extension`) to set a new default access level for all members defined within the extension.&quot;<br></div><div><br></div><div>I personally find that choice to be the clearer interpretation of the rule, because it&#39;s based entirely on what words are in the source file and not about how they interact in special edge cases.</div></div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div>Documentation is hard to keep in sync. </div><div><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md#complications-with-private-types" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md#complications-with-private-types</a> </div></div><div style="word-wrap:break-word"><div><br></div></div></blockquote><div><br></div><div>At the time SE-0025 was accepted, &quot;private extension&quot; would have been meaningless if it did not mean &quot;fileprivate&quot; because it predated the SE-0169 behavior extending &quot;private&quot; to extensions in the same file. The very issue being debated here is whether the oversight that SE-0169 did not consider extensions—now that &quot;private extension&quot; *could* have a meaningful use separate from &quot;fileprivate extension&quot;—is something that is worth correcting.</div><div><br></div><div>If the documentation is out-of-date and needs to be updated to list describe unintuitive special behavior, why not use the opportunity to make the behavior intuitive and consistent instead?</div><div><br></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"><div><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote"><div><br></div><div>I also think it&#39;s hard to rationalize &quot;private extension&quot; working like #2 because compared to #1, it&#39;s both duplicative (&quot;private extension&quot; and &quot;fileprivate extension&quot; are awkwardly the same) _and_ it is strictly less flexible (there is _no_ way using that syntax to define an extension whose members are private, which is an inconsistent hole in the language).</div></div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>This compiles on an Xcode 9 playground.  SE-0025 doesn&#39;t only affect extensions.</div><div>``MyClass.myFunc()` looks like (Choice 2) to me. Same as `private extension MyClass2`.</div><div><br></div><div><br></div><div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px"><br></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(222,56,165);background-color:rgb(0,0,0)">private<span style="color:#ffffff"> </span>class<span style="color:#ffffff"> MyClass {</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(0,0,0)">    <span style="color:#de38a5">static</span> <span style="color:#de38a5">func</span> myFunc(){</div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,70,71);background-color:rgb(0,0,0)"><span style="color:#ffffff">        </span><span style="color:#00b1ff">print</span><span style="color:#ffffff">(</span>“Acts likes fileprivate&quot;<span style="color:#ffffff">)</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(0,0,0)">    }</div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(0,0,0)">}</div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px"><br></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(222,56,165);background-color:rgb(0,0,0)">private<span style="color:#ffffff"> </span>class<span style="color:#ffffff"> MyClass2 {</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(0,0,0)">}</div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px"><br></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(222,56,165);background-color:rgb(0,0,0)">private<span style="color:#ffffff"> </span>extension<span style="color:#ffffff"> </span><span style="color:#08fa95">MyClass2</span><span style="color:#ffffff">{</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(0,0,0)">    <span style="color:#de38a5">static</span> <span style="color:#de38a5">func</span> myFunc2(){</div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,70,71);background-color:rgb(0,0,0)"><span style="color:#ffffff">       </span><span style="color:#00b1ff">print</span><span style="color:#ffffff">(</span>&quot;Same as MyClass.myFunc&quot;<span style="color:#ffffff">)</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(0,0,0)">    }</div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(0,0,0)">}</div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px"><br></div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px"><br></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(75,209,86);background-color:rgb(0,0,0)"><span style="color:#08fa95">MyClass</span><span style="color:#ffffff">.</span><span style="color:#08fa95">myFunc</span><span style="color:#ffffff">() </span>// Acts likes fileprivate</div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(75,209,86);background-color:rgb(0,0,0)"><span style="color:rgb(8,250,149)">MyClass2</span><span style="color:rgb(255,255,255)">.</span><span style="color:rgb(8,250,149)">myFunc2</span><span style="color:rgb(255,255,255)">() </span>// Same as MyClass.myFunc</div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px"><br></div></div></div></div><div style="word-wrap:break-word"><div><div><br></div></div></div></blockquote><div><br></div><div>This example is somewhat irrelevant to what&#39;s being discussed here—it&#39;s purely about SE-0025 behavior rather than, as the original message said, the extremely narrow specific case of access control for extensions.</div><div><br></div><div><br></div><div><br></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"><div><div></div><br><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote"><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div><div><br>And, as was already said, this inconsistency leads to *relaxed* access level, which can lead to bugs. If one expects &#39;private extension&#39; means &#39;fileprivate extension&#39; - compiler will show(with error) that this assumption is wrong just after the first attempt to access methods from outside of the extended type.<br>But if one expects true &#39;private&#39; access level - the methods from private extension could be called from any other code in the same file(by mistake, or because code was written a long time ago, or by another developer) and this clearly could produce complex bugs.<br><br>Also, isn&#39;t it a strange code below:<br><br>private extension MyType {<br> func foo() {}<br> private bar() {}<br> fileprivate baz() {} // note that &quot;usually&quot; fileprivate is &#39;wider&#39; access level<br>}<br></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div>This is also strange too :)</div><div><br></div><div> fileprivate class MyType {<br>  open func foo(){}  // Is this open or fileprivate?<br>  public func bar(){} <br>}<br><br> open class MyType2 {<br>}<br><br>open extension MyType2 { // Error: Extensions cannot use &#39;open&#39; as their default access; use &#39;public&#39;<br>    func baz(){}<br>}<br><br></div><div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div><br>but it has *currently* a sense - &#39;foo&#39; is fileprivate, and &#39;bar&#39; is &#39;true&#39; private.<br>Yes, currently we have a warning about &#39;baz&#39;: &quot;warning: declaring a fileprivate instance method in a private extension&quot;, but then we have a question &quot;Why?&quot;, as private at top level == fileprivate. and this does not produce any warnings:<br>fileprivate extension MyType {<br><span class="m_5385757261706514487m_736907767116209449Apple-tab-span" style="white-space:pre-wrap">        </span>fileprivate func foo() {}<br>}<br><br>Even more, someone can think &quot;why we need &#39;private&#39; declaration in private extension, probably this is a mistake i.e. unnecessary duplication of code, I&#39;ll refactor this and delete this explicit &#39;private&#39; because extension is already private&#39; and so will open doors for future problems.<br><br>So I do believe we really need to remove that ugly inconsistency and make Swift better to write, understand and support the code.<br></div></div></blockquote><br></div></div><div style="word-wrap:break-word"><div><div>This is matter of taste. For example I think fileprivate is ugly and having both private and fileprivate makes the code hard to understand. </div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div><br>Vladimir.<br><br><blockquote type="cite"><blockquote type="cite"><br><blockquote type="cite">private is different because it is scoped so because of that it is also different when dealing with extensions. Top level private is always the same as fileprivate thanks to its scoped nature.<br><br>Making private the scope ACL was a mistake but that ship has sailed and so has this one imo.<br><br><br><br>On Oct 4, 2017, at 10:05 PM, Tony Allevato &lt;<a href="mailto:tony.allevato@gmail.com" target="_blank">tony.allevato@gmail.com</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:tony.allevato@gmail.com" target="_blank">mailto:tony.allevato@gmail.com</a>&gt;&gt; wrote:<br><br><blockquote type="cite">Trust me, I&#39;m the last person who wants to rehash access levels in Swift again. But that&#39;s not what&#39;s happening here, IMO, and fixing bugs is not just &quot;a change for the sake of changing.&quot;<br><br>The current behavior of &quot;private extension&quot; is *incorrect*, because it&#39;s entirely inconsistent with how access levels on extensions are documented to behave and it&#39;s inconsistent with how other access levels apply to extensions.<br><br>Can anyone think of a reason—other than &quot;it&#39;s too late to change it&quot;—why &quot;private extension&quot; and &quot;fileprivate extension&quot; should behave the same, and why &quot;X extension { decl }&quot; should be identical to &quot;extension { X decl }&quot; for all X *except* &quot;private&quot;?<br><br>Yes, it&#39;s absolutely unfortunate that this oversight was not addressed when the other access level changes were made. But we shouldn&#39;t have to live with bugs in the language because we&#39;re afraid of some unknown amount of churn among code that is already written incorrectly. Nor is fixing this bug declaring open season on other, unrelated access level debates. Do you have data that shows that the amount of code broken because it&#39;s using &quot;private&quot; when it really should be saying &quot;fileprivate&quot; is high enough that we should just leave the bug there?<br><br>On Wed, Oct 4, 2017 at 9:51 PM Jose Cheyo Jimenez via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br><br>   There was a high bar for breaking changes in swift 4 and is even higher for swift 5.  se-110 was approved and<br>   implemented on the premises that it was not a big change but it was breaking code so it got reverted. Sure the<br>   migrator was making this easier but the result was a usability regression. I think this is a change just for the<br>   sake of changing. This will cause unnecessary churn. Let’s leave ACLs alone for the next few versions of swift<br>   unless we have a way better system.<br><br>   <a href="https://lists.swift.org/pipermail/swift-evolution-announce/2017-June/000386.html" target="_blank">https://lists.swift.org/pipermail/swift-evolution-announce/2017-June/000386.html</a><br><br><br><br><br><br>   On Oct 4, 2017, at 8:47 PM, BJ Homer &lt;<a href="mailto:bjhomer@gmail.com" target="_blank">bjhomer@gmail.com</a>&lt;<a href="mailto:bjhomer@gmail.com" target="_blank">mailto:bjhomer@gmail.com</a>&gt;&gt; wrote:<br><br><blockquote type="cite">   It certainly could break *some* code. But it only breaks code written by an author who wrote ‘private<br>   extension’ knowing that ‘fileprivate extension’ was also an option, but still intended it to be shared with the<br>   whole file. (If that code was from Swift 2, it would have already been migrated to ‘fileprivate extension’ by<br>   the 2-&gt;3 migrator.)<br><br>   So existing code that says ‘private extension’ was written in a Swift 3 or 4 era when ‘fileprivate’ was an<br>   option. If the goal was specifically to share it with the whole file, it seems likely that most authors would<br>   have used ‘fileprivate extension’ instead of ‘private extension’, as that better communicates the intention.<br>   Regardless, though, we could check against the Swift source compatibility test suite to see how widespread that is.<br><br>   Regardless, I think this change makes Swift a better language, and I’m in favor of it.<br><br>   -BJ<br><br>   On Oct 4, 2017, at 9:10 PM, Jose Cheyo Jimenez via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>   &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br><br><blockquote type="cite"><br><br>   On Oct 2, 2017, at 9:59 PM, David Hart via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>   &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br><br><blockquote type="cite"><br><br>   On 3 Oct 2017, at 05:12, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>   &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br><br><blockquote type="cite">   On Mon, Oct 2, 2017 at 9:16 PM, Matthew Johnson via swift-evolution&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>   &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt;wrote:<br><br><br><br>       Sent from my iPad<br><br>       On Oct 2, 2017, at 7:33 PM, Jordan Rose via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>       &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br><br><blockquote type="cite"><br><br><blockquote type="cite">       On Oct 2, 2017, at 03:25, Vladimir.S via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>       &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br><br>       On 01.10.2017 1:18, Chris Lattner wrote:<br><blockquote type="cite"><blockquote type="cite">       On Sep 29, 2017, at 10:42 AM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>       &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br><br>       Vladimir, I agree with you on that change, but it’s a separate topic from this one.<br><br>       Tony is absolutely correct that this topic has already been discussed. It is a deliberate design<br>       decision that public types do not automatically expose members without explicit access modifiers;<br>       this has been brought up on this list, and it is clearly not in scope for discussion as no new<br>       insight can arise this late in the game. The inconsistency with public extensions was brought up,<br>       the proposed solution was to remove modifiers for extensions, but this proposal was rejected. So,<br>       the final design is what we have.<br></blockquote>       Agreed.  The core team would only consider a refinement or change to access control if there were<br>       something actively broken that mattered for ABI stability.<br></blockquote><br>       So we have to live with *protected* extension inconsistency for very long time just because core team<br>       don&#39;t want to even discuss _this particular_ inconsistency(when access level in *private extension*<br>       must be private, not fileprivate)?<br><br>       Yes, we decided that access level for extension will mean a default and top most access level for<br>       nested methods, OK. But even in this rule, which already differ from access modifiers for types, we<br>       have another one special case for &#39;private extension&#39;.<br><br>       Don&#39;t you think this is not normal situation and actually there IMO can&#39;t be any reason to keep this<br>       bug-producing inconsistency in Swift? (especially given Swift 5 seems like is a last moment to fix this)<br></blockquote><br>       I hate to say it but I&#39;m inclined to agree with Vladimir on this. &quot;private extension&quot; has a useful<br>       meaning now distinct from &quot;fileprivate extension&quot;, and it was an oversight that SE-0169<br>       &lt;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0169-improve-interaction-between-private-declarations-and-extensions.md" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0169-improve-interaction-between-private-declarations-and-extensions.md</a>&gt; didn&#39;t<br>       include a fix here. On this/very narrow, very specific/access control issue I think it would still be<br>       worth discussing; like Xiaodi said it&#39;s not related to James&#39; original thread-starter.<br></blockquote><br>       I agree with this in principle but would not want to see it become a slippery slope back into extremely<br>       long access control discussions.<br><br><br>   As I&#39;ve said elsewhere, I too agree with this in principle. I agree with Jordan that the current state of<br>   things is justifiable but the alternative would be somewhat superior, agree that in a vacuum this very<br>   narrow and specific discussion might be warranted, and agree also that this could be a very slippery slide<br>   down a very steep slope.<br></blockquote><br>   Same here. It’s the only grudge I have left with the current access control situation. I remember Doug Gregor<br>   and John McCall discussing this during the last access control proposal. And I wouldn’t mind having a very<br>   narrow discussion about only this.<br><br>   I organize my types into extensions for each conformance and for each access control. I can currently<br>   implicitly apply public or fileprivate to all members of an extension but I have no way of doing the same for<br>   private. That’s why I think it should be fixed.<br></blockquote><br>   This will break a bunch of code because `private extension` has_always_meant `fileprivate extension`.Even<br>   Swift 3 had this same behavior. Lowering the access level of the extension members will hide a bunch of code<br>   that was visible to the file.<br><br>   169 was not a breaking change but this “fix” would have made it a breaking change. I doubt 169 would had been<br>   accepted if it was a breaking change. I don’t think it’s worth it.<br><br><br>   <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0169-improve-interaction-between-private-declarations-and-extensions.md" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0169-improve-interaction-between-private-declarations-and-extensions.md</a><br><br><br><br><blockquote type="cite"><br><blockquote type="cite"><blockquote type="cite"><br>       (I maintain that the current model does/not/ include a special case; it simply means the &#39;private&#39; is<br>       resolved at the level of the extension rather than the level of its members. But that isn&#39;t what people<br>       expect and it&#39;s not as useful.)<br><br><br>       I agree that changing the behavior of/all/ access modifiers on extensions is out of scope. (I also<br>       agree that it is a bad idea. Sorry, James, but wanting &#39;pubic&#39; here indicates that your mental model of<br>       extensions does not match what Swift is actually doing, and that could get you into trouble.)<br><br>       Jordan<br><br>       _______________________________________________<br>       swift-evolution mailing list<br>       <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;<br>       <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></blockquote><br>       _______________________________________________<br>       swift-evolution mailing list<br>       <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;<br>       <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br><br><br>   _______________________________________________<br>   swift-evolution mailing list<br>   <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;<br>   <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></blockquote>   _______________________________________________<br>   swift-evolution mailing list<br>   <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;<br>   <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></blockquote>   _______________________________________________<br>   swift-evolution mailing list<br>   <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;<br>   <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></blockquote></blockquote>   _______________________________________________<br>   swift-evolution mailing list<br>   <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;<br>   <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></blockquote>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><span class="m_5385757261706514487Apple-converted-space"> </span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;<br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></blockquote></blockquote>_______________________________________________<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></blockquote></div></div></blockquote></div></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></blockquote></div></div></div></blockquote></div></div></blockquote></div></div>