<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><span></span></div><div>One argument: without this fix, private is the only access level for which we have no means to easily and implicitly apply an access level to a group of members. And it bums me to have to explicitly type private on ever single member to achieve the same result as I can with any other access level.</div><div><div><br>On 7 Oct 2017, at 07:07, Jose Cheyo Jimenez via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 6, 2017, at 9:35 PM, Tony Allevato <<a href="mailto:tony.allevato@gmail.com" class="">tony.allevato@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Oct 6, 2017 at 9:29 PM Jose Cheyo Jimenez <<a href="mailto:cheyo@masters3d.com" class="">cheyo@masters3d.com</a>> wrote:<br class=""></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" class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 6, 2017, at 8:58 PM, Tony Allevato <<a href="mailto:tony.allevato@gmail.com" target="_blank" class="">tony.allevato@gmail.com</a>> wrote:</div><br class="m_-164326603858471284Apple-interchange-newline"><div class=""><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" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Oct 6, 2017 at 8:45 PM Jose Cheyo Jimenez <<a href="mailto:cheyo@masters3d.com" target="_blank" class="">cheyo@masters3d.com</a>> wrote:<br class=""></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" class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 6, 2017, at 8:01 PM, Tony Allevato <<a href="mailto:tony.allevato@gmail.com" target="_blank" class="">tony.allevato@gmail.com</a>> wrote:</div><div class=""><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" class=""><div class="gmail_quote"><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" class=""><div class=""><br class=""></div></div></blockquote><div class="">At the time SE-0025 was accepted, "private extension" would have been meaningless if it did not mean "fileprivate" because it predated the SE-0169 behavior extending "private" 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 "private extension" *could* have a meaningful use separate from "fileprivate extension"—is something that is worth correcting.</div><div class=""><br class=""></div><div class="">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></div></div></blockquote><div class=""><br class=""></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class="">Lets say you “fix” the private extension override. Now MyClass2.myFunc2() is not accessible from outside the type. </div><div class="">Wouldn't MyClass2.myFunc2() now be inconsistent with MyClass.myFunc()? </div><div class="">I don’t think you can make a change to one with out causing other inconsistencies. I rest my case. :) </div></div></div></blockquote><div class=""><br class=""></div><div class="">No, because a class is a concrete "thing" whose access level which—while providing an upper bound for access levels of its defaulting members—is otherwise independent of the access level of its members.</div><div class=""><br class=""></div><div class="">Extensions, on the other hand, aren't a concrete thing of their own. The access level on an extension exists *solely* as a shortcut to specify the upper bound for its defaulting members that are injected into the main type.</div><div class=""><br class=""></div><div class="">What happens in your example if you replace "private" with "public"? Then myFunc has internal access but myFunc2 is public. So the "inconsistency" you're pointing out between access inherited from a type and access inherited from an extension already exists—they're apples and oranges.</div><div class=""><br class=""></div><div class="">That's why access levels of classes/structs/other types aren't relevant examples here—extensions treat access levels fundamentally differently.</div></div></div></div></blockquote></div></div><div style="word-wrap:break-word" class=""><div class="">Sure. Extensions apply a default upper bound and types can lower the upper bound of the default internal members. The upper bound on the below example is the same for both when dealing with top level private.</div><div class=""><br class=""></div><div class="">Extensions should resolve their upper bound accessibility where the ‘private’ appears explicitly and this now happens to be the same for both types and extensions regardless of how they are enforced. </div></div></blockquote><div class=""><br class=""></div><div class="">But *why* do you think that should be? You're stating what the current situation is and you say that it "should" be that way, but why should we accept that status quo instead of making "private extension" more useful for people who use "private" in the sense introduced by SE-0169, when the argument for consistency can honestly be argued either way (the two options I wrote a few messages up)?</div></div></div></div></blockquote><div><br class=""></div>Oh :) Because I believe that lowering the scope of “private extension” would undermine the spirit of 169. 169 was a compromise after 159 was rejected. 169 was meant to make fileprivate less common and thus more meaningful when it occurs in source. Where 169 was meant to relax the rules, the proposed “fix” would force people who now use “private extension” to use “fileprivate extension” thus making fileprivate more common. In other words, 169 was about relaxing rules and not about tightening down the rules or allowing “true” private to be applied as a default ACL extension.</div><div><br class=""></div><div>“scoped" `private extension` can’t be archived now in the same way that ‘open extension’ is not allowed. The lowest and highest ACL are not able to be applied as default extension modifiers and this makes sense to me. </div><div><br class=""></div><div><pre style="white-space: pre-wrap; font-variant-ligatures: normal; orphans: 2; widows: 2;" class="">There is no solution that will make everyone happy: maintaining the status quo makes “fileprivate” too common and therefore not meaningful when it occurs in source; removing or diluting scope-level access control (as in SE-0159 <<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md</a>> and this proposal)</pre><div class=""><a href="https://lists.swift.org/pipermail/swift-evolution-announce/2017-April/000357.html" class="">https://lists.swift.org/pipermail/swift-evolution-announce/2017-April/000357.html</a></div></div><div><br class=""></div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div class=""><br class=""></div><div class=""> </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" class=""><div class=""><blockquote type="cite" class=""><div class=""><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" class=""><div class="gmail_quote"><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" class=""><div class=""><div class=""><br class=""></div><div class=""><div class=""><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(222,56,165);background-color:rgb(0,0,0)" class="">private<span style="color:rgb(255,255,255)" class=""> </span>class<span style="color:rgb(255,255,255)" class=""> 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)" class=""> <span style="color:rgb(222,56,165)" class="">static</span> <span style="color:rgb(222,56,165)" class="">func</span> myFunc(){ <span style="color:rgb(75,209,86)" class="">// This would now act differently from private extensions? </span></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)" class=""><span style="color:rgb(255,255,255)" class=""> </span><span style="color:rgb(0,177,255)" class="">print</span><span style="color:rgb(255,255,255)" class="">(</span>"acts like fileprivate now"<span style="color:rgb(255,255,255)" class="">)</span></div></div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(0,0,0)" class=""> }</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)" class="">}</div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px" class=""><br class=""></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)" class=""><span style="color:rgb(222,56,165)" class="">private</span> <span style="color:rgb(222,56,165)" class="">class</span> MyClass2 {}</div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px" class=""><br class=""></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)" class="">private<span style="color:rgb(255,255,255)" class=""> </span>extension<span style="color:rgb(255,255,255)" class=""> </span><span style="color:rgb(8,250,149)" class="">MyClass2</span><span style="color:rgb(255,255,255)" class="">{</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)" class=""> <span style="color:rgb(222,56,165)" class="">static</span> <span style="color:rgb(222,56,165)" class="">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)" class=""><span style="color:rgb(255,255,255)" class=""> </span><span style="color:rgb(0,177,255)" class="">print</span><span style="color:rgb(255,255,255)" class="">(</span>"Same as MyClass.myFunc"<span style="color:rgb(255,255,255)" class="">)</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)" class=""> }</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)" class="">}</div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px" class=""><br class=""></div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(0,0,0);min-height:14px" class=""><br class=""></div></div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><div style="margin:0px;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(75,209,86);background-color:rgb(0,0,0)" class=""><span style="color:rgb(8,250,149)" class="">MyClass</span><span style="color:rgb(255,255,255)" class="">.</span><span style="color:rgb(8,250,149)" class="">myFunc</span><span style="color:rgb(255,255,255)" class="">() </span>// acts like 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)" class=""><span style="color:rgb(8,250,149)" class="">MyClass2</span><span style="color:rgb(255,255,255)" class="">.</span><span style="color:rgb(8,250,149)" class="">myFunc2</span><span style="color:rgb(255,255,255)" class="">() </span>// The proposed change would hide myFunc2</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)" class=""><span style="color:rgb(255,255,255)" class=""> </span>//Error: 'myFunc2' is inaccessible due to 'private' protection level</div></div></div></div></div></blockquote></div></div></div></blockquote></div><br class=""></div></blockquote></div></div>
</div></blockquote></div><br class=""></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></body></html>