[swift-evolution] Type-based ‘private’ access within a file

Víctor Pimentel Rodríguez vpimentel at tuenti.com
Tue Apr 4 08:50:02 CDT 2017

On Mon, Apr 3, 2017 at 8:34 PM, Douglas Gregor via swift-evolution <
swift-evolution at swift.org> wrote:

> The design, specifically, is that a “private” member declared within a
> type “X” or an extension thereof would be accessible from:
> * An extension of “X” in the same file
> * The definition of “X”, if it occurs in the same file
> * A nested type (or extension thereof) of one of the above that occurs in
> the same file

Strongly +1, and I fully agree with David Hart draft.

As an app developer that works with Swift everyday, this will fix most of
my pain-points with scoped access. It will not only ease a very popular use
of extensions, but when asking a new developer this is the default that
makes more sense.

Being selfish, with this proposal, you could even delete fileprivate, I
would never use it or recommend it. If you want a type private to a file,
enclose it under other type.

Víctor Pimentel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170404/8868efb8/attachment.html>

More information about the swift-evolution mailing list