[swift-evolution] private & fileprivate

Charles Srstka cocoadev at charlessoft.com
Fri Oct 14 04:14:10 CDT 2016


> On Oct 13, 2016, at 1:25 AM, Jean-Daniel via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I don’t think monitoring the usage of private vs fileprivate is fair. By default, people will use private until they encounter visibility issues and discover they need to change to fileprivate. So private will probably being use far more than fileprivate.
> Nonetheless it does not mean people chosen private because it effectively reduce the visibility to the class scope, but just because it is easier to discover and to type than fileprivate and fit in many cases.

How is that an argument against private, though? If private is used far more often than fileprivate, then this suggests that the vast amount of the time, the scope it provides is what is appropriate. The enlarged scope provided by fileprivate, then, is needed for what are essentially edge cases. It makes little sense, to my mind, to replace the mainstream option with the niche one.

Charles

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161014/19e06aac/attachment.html>


More information about the swift-evolution mailing list