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

Michel Fortin michel.fortin at michelf.ca
Mon Apr 3 16:12:18 CDT 2017


> Le 3 avr. 2017 à 16:20, John McCall via swift-evolution <swift-evolution at swift.org> a écrit :
> 
>> I hope the core team will reconsider the spelling change to “private” and “scoped”.
> 
> We won't.

I find that unfortunate, but it's good to be fixed.

I recently replaced every instance of `private` by `fileprivate` in my code. This discussion made me realize that the intended unit of encapsulation for me when I write `private` is almost always the file. The code should reflect that intent regardless of whether the compiler would allow a narrower access level to be used.

I will reserve `private` for special occasions when tighter encapsulation is needed. Doing it that way, `private` will actually have some meaning when I use it. Current use is zero though, and that's fine by me.

As for introducing type-based private, it'd probably make using `private` for special occasions less interesting because the additional protection over `fileprivate` are negligible.

-- 
Michel Fortin
https://michelf.ca



More information about the swift-evolution mailing list