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

Adam Knight adam at movq.us
Mon Apr 3 22:14:17 CDT 2017


On Apr 3, 2017, at 2:36 PM, Charles Srstka via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> On Apr 3, 2017, at 2:28 PM, David Hart via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> Btw, I know what I'm going to propose is a bit crazy, but how about making private visible to extensions even outside the file but in the same module?
> 
> That’s actually what I suggested in my original post on the topic. My feeling was that it would allow breaking a particularly large type into separate files, thus alleviating the “huge file” problem that Swift has (and which Charlie Monroe brought up as a concern).
> 
> It’s still what I’d prefer personally, although I can understand why the core team might want to restrict it to files.

FWIW, I think this is the way to go.  It’s also more in line with other languages and how they handle “class internal”.  The only one that should care about the file is fileprivate, and I honestly think I’d never wind up using that if private were fixed properly (current type + same-module extensions + any file).

— Adam

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


More information about the swift-evolution mailing list