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

Víctor Pimentel Rodríguez vpimentel at tuenti.com
Fri Apr 7 11:27:54 CDT 2017


On Fri, Apr 7, 2017 at 5:47 PM, Matthew Johnson via swift-evolution <
swift-evolution at swift.org> wrote:

> Setting aside source compatibility concerns for a brief moment, is there
> anyone who would choose this approach over reverting SE-0025, renaming the
> current modifier, or maintaining the current access modifiers?  If this is
> nobody’s first choice that should be a big cautionary sign.
>

After migrating several codebases, I think the best for me would be moving
in the direction explained in this proposal. For these reasons:

- In the migration to Swift 4, my team's code would work right away,
without any changes at all (well, at least because of this proposal).
- When my team have the time to do it, we can replace all of our
fileprivate usages for private ones, since we just use them to share
properties between same-file extensions.

So at the end this proposal will impact my team very little at first, we
will have less merge issues (hello Swift 3) and eventually the code will
be, for us, cleaner and easier to read. All the other proposals will not
give my team this smooth transition.

And, IMHO, I think that having access to really private details between two
types probably leads to programmer errors, so my next preferred step after
this one would be removing fileprivate altogether.

But I understand that Swift as a language must be gradually shaped.

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


More information about the swift-evolution mailing list