> On 31 Mar 2016, at 07:22, Chris Lattner via swift-evolution 
> <[email protected]> wrote:
> 
> I’ve seen a number of concerns on this list about moduleprivate, and how it 
> penalizes folks who want to explicitly write their access control.  I’ve come 
> to think that there is yes-another possible path forward here (which I 
> haven’t seen mentioned so far):
> 
> public
> internal
> fileprivate
> private

+1, I like it.

There's one source of confusion though: at file scope, `private` would have the 
same meaning as `fileprivate`.

// At file scope, these keywords are synonymous unless we specify otherwise:
private let someConstant = "foo"
fileprivate let anotherConstant = "bar"

That can be seen in positive light too—the shorter keyword is tempting—, but 
wouldn't it make things clearer if `private` was only allowed inside data types?

Then, file-wide constants, helper functions, and types would then all be at 
least `fileprivate`, and never `private`. I think that would best document 
their intent. Maybe just a warning with a fixit to use `fileprivate` would be 
enough.

— Pyry Jahkola

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to