[swift-evolution] [Review] SE-0159: Fix Private Access Levels

Rien Rien at Balancingrock.nl
Sun Mar 26 06:42:53 CDT 2017


> On 26 Mar 2017, at 13:23, Andrey Tarantsov via swift-evolution <swift-evolution at swift.org> wrote:
> 
> > What is your evaluation of the proposal?
> 
> Very strong -1. Drew has said it all.
> 
> A few extra points:
> 
> * If you split a class into a bunch of extensions, chances are it's a large class, and fileprivate keyword provides crucial documentation on which methods and fields are accessed from outside the scope. Even if someone blindly uses private until compiler complains, then switches to fileprivate without thinking, there's still value when reading the code. (This has been mentioned as one of the points against scoped private.)

it should, but fileprivate only means that something can be done, not that something is done.
And unfortunately or not, people will use this keyword in the wrong way, forget to update access levels after changes etc.
So while this should be true in theory, in praxis it is almost never the case.

Rien.

> 
> * Encapsulation is in the spirit of Swift's safety goals, we want to encourage it.
> 
> * // MARK is perfectly fine for tightly-coupled class bodies, so if you find yourself using tons of fileprivate, consider switching to a single body with marks
> 
> * I really like the point that we should uphold the original decision unless we find new compelling arguments that were not considered initially.
> 
> 
> > Is the problem being addressed significant enough to warrant a change to Swift?
> 
> No. I haven't personally seen any complains about this feature in my circles; everyone is happy about tighter access controls.
> 
> 
> > Does this proposal fit well with the feel and direction of Swift?
> 
> It feels actively against the safety and readability goals of Swift.
> 
> 
> > If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
> 
> This has been beaten to death in the original proposal.
> 
> 
> > How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
> 
> Thorough reading of the first half of this discussion, and active participation in the original discussion (as well as writing and shipping lots of Swift code since Swift 0.x).
> 
> A.
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list