[swift-evolution] Class scoped access level
Karl
razielim at gmail.com
Sat Sep 10 07:54:12 CDT 2016
> On 10 Sep 2016, at 14:16, T.J. Usiyan via swift-evolution <swift-evolution at swift.org> wrote:
>
> I am firmly against this. The 5 levels that we have cover us well and have enough complexity already.
You can say that again! It seems the compiler has become much stricter about it very recently.
I was recently writing a Tab-bar UIViewcontroller and because I like to keep my internal API clean, I’ve had to stick 4 massive related classes and various extensions in the same file. It’s an unreadable, unmaintainable nightmare.
I would support abolishing the ‘fileprivate’ level for some kind of more loosely-defined virtual scope, such as friend classes or submodules.
OP is correct that Swift is currently incongruous - on the one hand, we have extensions allowing you to break up definitions in to relatable groups, and on the other hand we force you to jam everything in to one file if you want a clean internal API. It feels like they are pulling in opposite directions.
More information about the swift-evolution
mailing list