[swift-evolution] [Discussion] fileprivate vs. private(file)
razielim at gmail.com
Mon Feb 20 18:22:43 CST 2017
> On 21 Feb 2017, at 01:00, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> I'm terribly sorry to be _that guy_, but I have to interject that `private(file)` was discussed extensively during review for SE-0025, that the full scheme laid out in the first message of this thread was given consideration, and that the core team took these suggestions into account before accepting and implementing `fileprivate`.
> Now, it has been said that real-world experience opens the door to reconsidering the substantive content of SE-0025 (as in, whether "new" private should exist at all). It has also long been said that a superior name would be considered instead of `fileprivate` if someone came up with one. But clearly, if hundreds of messages advocating for `private(file)` did not cause the core team to consider it to be a superior name, it is exceedingly poor form to keep bringing it up again. It's already exhausting to bikeshed upcoming features, but this shed has already shipped.
We are seeing lots of topics about access control in general. It’s clear people aren’t completely satisfied, but I don’t have a clear, coherent picture of what people dislike the most.
Personally, I just don’t like fileprivate, just like I didn’t like it’s ol’ pap, file-scoped “private”. Especially now we don’t have header files, I sometimes want to restrict access of a member to certain other types without making them exposed throughout the entire module (so the rest of my internal code is written in the closest thing to the client’s experience). At the same time, sticking everything in to one enormous file can sometimes be hard to manage - I end up with quarter-screens full of whitespace to act as visual separators.
I don’t know exactly what to suggest, but I feel we need to organise and answer the general grievances about access control and update the FAQ.
More information about the swift-evolution