<div dir="ltr">I agree. I'll post a draft of a proposal surrounding this topic shortly :)<div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 16, 2016 at 12:09 PM, Paul Cantrell via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><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>Like others, I do find the details of this proposal hard to follow. It doesn’t seem like a simpler mental model for developers.</div><div><br></div><div>However, I also find the <i>current</i> rules around extension access modifiers hard to follow. It’s confusing that “public extension” changes the default for members, when “public class” and “public struct” don’t. And this is not ideal:</div><div><br></div><div><div style="margin:0px;font-size:10.5px;line-height:normal;font-family:Menlo;color:rgb(88,126,168)"><div style="margin:0px;font-size:10.5px;line-height:normal;color:rgb(102,139,73)"><span style="color:#323e7d">extension</span><span style="color:#000000"> </span><span style="color:#587ea8">String</span><span style="color:#000000">: </span><span style="color:#587ea8">Fungible</span><span style="color:#000000"> </span><span>// Extension not “public”, but the conformance is public?</span></div></div></div><div><br></div><div>IMO, every public API commitment a module makes should include the word “public” at the declaration site.</div><div><br></div><div>Because of all this, I have stopped using extension-level access modifiers altogether, instead always specifying access at the member level. I would be interested in a proposal to improve the current model — perhaps, for example, making “public extension” apply only to a protocol conformance, and disabling access modifiers on extensions that don’t have a protocol conformance.</div><div><br></div><div>Cheers, P</div><div><div><br><div><blockquote type="cite"><div>On Jul 16, 2016, at 11:36 AM, Adrian Zubarev via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><p style="margin:15px 0px">If it’s possible I’d like to withdraw this proposal. I’m convinced by the feedback from the community. Feel free to reject it. ;)</p></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><div><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div><br><p style="margin:15px 0px">Am 13. Juli 2016 um 19:33:00, John McCall via swift-evolution (<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">swift-evolution@swift.org</a>) schrieb:</p><blockquote type="cite" style="margin:15px 0px"><span style="margin-top:0px;margin-bottom:0px"><div style="word-wrap:break-word"><div></div><div><div><blockquote type="cite" style="margin:15px 0px"><div style="margin-top:0px">On Jul 13, 2016, at 10:26 AM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">swift-evolution@swift.org</a>> wrote:</div><div style="margin-bottom:0px">As Jordan mentioned, I don't (and I think other people don't) think of extensions as their own entities, as they can't be referred to and have no runtime representation. In that mental model, there isn't such a thing as "an extension being public." Instead, the access modifier is just a shorthand default for the properties and methods it contains, which is teachable but unique to extensions. It is a matter of opinion whether that uniqueness is a feature or a bug.<br></div></blockquote><div><br></div>I would say that it's interesting but ultimately not worth the confusion about the nature of extensions.</div><div><br></div><div>John.</div><div><br><blockquote type="cite" style="margin:15px 0px"><div style="margin-top:0px;margin-bottom:0px"><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 13, 2016 at 12:19 Jose Cheyo Jimenez <<a href="mailto:cheyo@masters3d.com" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">cheyo@masters3d.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="auto" style="margin-top:0px"><div></div><div><br></div><div><br>On Jul 13, 2016, at 8:46 AM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite" style="margin:15px 0px"><div style="margin-top:0px;margin-bottom:0px"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 13, 2016 at 4:04 AM, Rod Brown via swift-evolution<span> </span><span dir="ltr"><<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">swift-evolution@swift.org</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="margin-top:0px;margin-bottom:0px;word-wrap:break-word"><div>Proposal link:<span> </span><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0119-extensions-access-modifiers.md" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0119-extensions-access-modifiers.md</a></div><div><br></div><div><blockquote type="cite" style="margin:15px 0px"><span style="margin-top:0px;margin-bottom:0px">* What is your evaluation of the proposal?<br></span></blockquote><div>-1. Extensions appear to me to follow the access control of the rest of Swift: Implicit to the type you are extending, and you can either / both declare as part of the extension declaration or on the method. I don’t see how this is confusing, and I expect people will be more confused that extensions don’t follow the convention of the rest of Swift for Access Control.</div></div></div></blockquote><div><br></div><div>So, actually, the proposal is correct that extensions (at least once fileprivate/private is implemented) don't follow the access control rules for the rest of Swift. There is a problem to be addressed. However, I agree that this proposal hasn't identified the issue or adequately explained how the solution solves it. Here's the problem I'm thinking of:</div><div><br></div><div>```</div><div>public struct foo {</div><div> func frobnicate() { } // implicitly internal</div><div>}</div><div><br></div><div>public struct bar { }</div><div>public extension bar {</div><div> func frobnicate() { } // implicitly public</div><div> // at least, according to the revised rules explained in SE-0025</div><div>}</div><div>```</div></div></div></div></div></blockquote><div><br></div></div><div dir="auto"><div>There is definitely a difference, I think that is a good thing.<span> </span><span style="background-color:rgba(255,255,255,0)">They look similar but they are completely different. </span></div><div><br></div><div>public Type // the type is public</div><div>public extension Type // the extension is public </div><div><br></div><div>For extensions, public is just a modifier on extension, not the type. The default scope inside the extension is that of the "modifier" keyword on the extension. </div><div><br></div><div>This is easy to explain to someone new. </div></div><div dir="auto" style="margin-bottom:0px"><div><br></div><br><blockquote type="cite" style="margin:15px 0px"><div style="margin-top:0px;margin-bottom:0px"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>This is an inconsistency that may (and IMO, really is) worth addressing. If there's adequate interest, I can circulate a draft with a proposed solution I have in mind.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="margin-top:0px;word-wrap:break-word"><div><span><br></span><blockquote type="cite" style="margin:15px 0px"><span style="margin-top:0px;margin-bottom:0px">* Is the problem being addressed significant enough to warrant a change to Swift?<br></span></blockquote><div>I don’t think this warrants a change.</div><span><br></span><blockquote type="cite" style="margin:15px 0px"><span style="margin-top:0px;margin-bottom:0px">* Does this proposal fit well with the feel and direction of Swift?<br></span></blockquote>No. This seems to go against the direction of Swift.</div><div><span><br></span><blockquote type="cite" style="margin:15px 0px"><span style="margin-top:0px;margin-bottom:0px">* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br></span></blockquote><div>No.</div><div><span><br></span></div><blockquote type="cite" style="margin:15px 0px"><span style="margin-top:0px;margin-bottom:0px">* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?</span></blockquote>A reading of the proposal.</div><div><br></div></div><br>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br><br style="margin-bottom:0px"></blockquote></div><br></div></div></div></blockquote><blockquote type="cite" style="margin:15px 0px"><div style="margin-top:0px;margin-bottom:0px"><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></blockquote></div>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></div></span></blockquote></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><div style="margin:15px 0px"><br></div></div><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254);float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254);float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:rgb(254,254,254);text-decoration:none;font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color:rgb(65,131,196);background-color:rgb(254,254,254);text-decoration:none;font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"></div></blockquote></div><br></div></div></div><br>_______________________________________________<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>
<br></blockquote></div><br></div></div>