[swift-evolution] private & fileprivate

Braeden Profile jhaezhyr12 at gmail.com
Fri Oct 7 20:49:00 CDT 2016

> On Oct 7, 2016, at 5:46 PM, Trans via swift-evolution <swift-evolution at swift.org> wrote:
> Private access that limits exposure to extensions and subclasses is
> the bane of reusability. It sucks in Java and it sucks in Swift. As
> far as I know Ruby is the only language that seems to get that.

Agreed.  Reading this thread, almost everyone’s presented actual use cases would be fixed if we could do something functionally equivalent to private(type) (even if that’s not the best syntax).  If we could have the ability to write extensions for a type throughout a module and access its private properties (and private subtypes, methods, etc.), then the ugliness introduced by fileprivate would be all but eliminated.  That’s an access level I would love.

I do want to mention, though, that while I would enjoy C++-style type-level private, I don’t want protected.  The rationale for avoiding that in Swift is fantastic.

> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

More information about the swift-evolution mailing list