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

Matthew Johnson matthew at anandabits.com
Wed Jun 29 18:10:24 CDT 2016


> On Jun 29, 2016, at 6:07 PM, David Hart via swift-evolution <swift-evolution at swift.org> 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.

It’s clear that *some* people are writing Swift this way.  But I don’t think it is the most common style.  I think it’s more common to put “core” members inside the type declaration.  With that style the need for `fileprivate` is minimized.

> 
> 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`.

Files introduce a scope in the same sense that modules do.  

> 
> I'm getting more and more confused about SE-0025.
> _______________________________________________
> 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