What problem do access levels solve? I can think of just one problem: prevent an API user from accessing a part of an interface that for syntactic reasons has to be in that interface, but should not be accessible.
All the other uses are design oriented, and therefor highly debatable (“religious”). This is imo the reason for the lengthy debates on this topic. Hence my preference for just the three original levels. They were well thought out, and made sense since there is no longer a separation between spec and implementation. Moreover, they are simple to understand even while different than in other languages. Any additions, make it more difficult to understand and need more justification as to why it is still not the same as in other languages. Regards, Rien Site: http://balancingrock.nl Blog: http://swiftrien.blogspot.com Github: http://github.com/Balancingrock Project: http://swiftfire.nl > On 15 Feb 2017, at 08:05, David Hart via swift-evolution > <swift-evolution@swift.org> wrote: > > > > > Sent from my iPhone > On 15 Feb 2017, at 06:31, Chris Lattner <sa...@nondot.org> wrote: > >> >>> On Feb 14, 2017, at 3:20 AM, David Hart <da...@hartbit.com> wrote: >>> >>> >>> On 14 Feb 2017, at 09:25, Goffredo Marocchi <pana...@gmail.com> wrote: >>> >>>> I disagree with that as well as I still think we are damaging the language >>>> each time we take a known concept (like access levels) and give new >>>> meanings to the same keywords. I still look baffled at the redefinition of >>>> do and the addition of repeat for example... >>>> >>>> Private, the way it was before, was an admittedly curious take on how most >>>> languages mean by private and we have jumped through a lot of hoops to >>>> justify why we did not start with Java/C++/C# like access control and >>>> augmented it instead of redefining things, omitting others, and then >>>> constantly pulling the language left and right with not a lot of permanent >>>> consensus either way as this discussion and others before show. >>> >>> It's a curious take, but it is a curious take is perfectly coherent with >>> Swift extensions. How else would you access private implementation details >>> from an extension? But putting it in the same file, instead of having to >>> resort to an internal access level. >> >> Right. Swift is its own language distinct from Java/C++/etc. While it is >> intentionally designed to remain familiar (and thus reuses many keywords >> across the language family), it often does so with slightly different >> meaning / behavior. Consider ‘throw’ for example. >> >> Keeping with the spirit of Swift and staying consistent with its design, I >> see two plausible meanings for private: >> >> Private could mean either: >> 1) private to the file (Swift 2 semantics) >> 2) accessible only to the current type/scope and to extensions to that type >> that are in the current file. > > I think (2) is worth discussing. My 2 cents: > > Pros > • Solves a high percentage of use cases of fileprivate > • Type-scope proponents retain some of the safety > > Cons > • Less straight forward to explain > • Access to different type/scope in same file not possible anymore > > Honestly, I'd be quite happy about this compromise. :) > >> I don’t think we’ve ever evaluated and debated approach #2 systematically. >> >> -Chris >> > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution