[swift-evolution] SE-0025: Scoped Access Level, next steps

Pyry Jahkola pyry.jahkola at iki.fi
Thu Mar 31 01:34:40 CDT 2016


> On 31 Mar 2016, at 07:22, Chris Lattner via swift-evolution <swift-evolution at swift.org> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160331/fe6ebd04/attachment.html>


More information about the swift-evolution mailing list