[swift-evolution] [swift-evolution-announce] [Review] SE-0159: Fix Private Access Levels

Tino Heth 2th at gmx.de
Tue Mar 21 11:36:49 CDT 2017


>> > Fact is, you can replace every occurrence of "private" with "fileprivate", and your source would compile as before, whereas fileprivate saves us from a "friend"-keyword.
> 
> This is certainly a source-breaking change.  Consider:
> 
>> struct Foo {
>> 
>>     fileprivate func foo()->String {return "foo" }
>> 
>>     private func foo()->Int {return 2}   
>> 
>> }
>> 
>> print("\(Foo().foo())")
>> 
> Replacing “private” with “fileprivate” here will introduce a compile error.
> 
True indeed… but can we agree that this is just an hypothetic example, and no issue that is likely to happen in productive code?
Or is this actually taken from one of the projects you measured?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170321/6b772851/attachment.html>


More information about the swift-evolution mailing list