[swift-evolution] [Discussion] A Problem With SE-0025?

Jose Cheyo Jimenez cheyo at masters3d.com
Wed Jun 29 18:37:49 CDT 2016


> On Jun 29, 2016, at 4:07 PM, David Hart <david at hartbit.com> wrote:
> 
> 
>> On 29 Jun 2016, at 22:15, Jordan Rose via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> There actually is an answer to this, which is that the core team expects 'private' to be the common keyword, and therefore it’s better if you can use it at the top level and ignore ‘fileprivate’ altogether in most programs.
> 
> This makes no sense to me for two reasons:
> 
> 1) As I previously said, I don't expect `private` to be the common keyword if people keep writing types as a main declaration and a set of extensions. With that style, we'll be using `fileprivate` heavily for properties in the main declaration.
> 
> 2) If private means only visible to its lexical scope, I would have expected private top level declarations to be visible to the global scope, which is equivalent to `internal` for me, no `fileprivate`.
> 
> I'm getting more and more confused about SE-0025.

"In the degenerate case of a top level declaration, “private” and “fileprivate” are the same thing, 
since the scope that “private” refers to is the whole file. “ -Chris Lattner 

http://article.gmane.org/gmane.comp.lang.swift.evolution/13282/ <http://article.gmane.org/gmane.comp.lang.swift.evolution/13282/>

Since private at the top level means fileprivate, 
it makes sense that the nested declarations of top level fileprivate default to fileprivate.

The only thing that was a little confusing for me was to allow top level private (since it is the same thing as fileprivate)
 but I think it is something once you learn it then it will make sense. (Maybe just hard to explain though)

+1 I am on board. I do not think this needs full review. 



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


More information about the swift-evolution mailing list