[swift-evolution] final + lazy + fileprivate modifiers

Joanna Carter joanna at carterconsulting.org.uk
Mon Feb 20 06:35:47 CST 2017


> Le 20 févr. 2017 à 13:29, David Hart <david at hartbit.com> a écrit :
> 
> I don't agree with this point. I'm for a file-based private, but I definitely do NOT want access control eliminated, quite the contrary. I think the arguments are much subtle than what is presented here. I want strong access control, and to have that, the access control modifiers should be powerful and few do they are actually used. Right now we have private and fileprivate and many people don't use them consistently because they are so similar. We need only one private access control and I'm voting for fileprivate because it is the one which is the simplest while still working well with Swift's extension mechanisms.

But the problem is, fileprivate may work well with Swift's extension mechanism but only if you place those extensions in the same file.

What I am fighting for is an access specifier that allows us to extend types in another file, to avoid the gargantuan file syndrome that can easily ensue if you need many extensions to the type.

Don't forget, if it's visible to another file, it can be abused by the inexperienced working in the same module

--
Joanna Carter
Carter Consulting



More information about the swift-evolution mailing list