Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-29 Thread Clément NONN via swift-users
fileprivate and private aren’t the same thing : try this on a playground : class Foo { fileprivate let test = "test" private let test2 = "test2" } let foo = Foo() foo.test foo.test2 You can see that foo.test work because his scope is the file whereas test2 doesn’t compile :

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Fritz Anderson via swift-users
On 28 Sep 2016, at 9:29 AM, Dave Reed via swift-users wrote: > > They aren't identical. Here's a good explanation: > > http://useyourloaf.com/blog/swift-3-access-controls/ > Useful, but the OP asks about “global”

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Nevin Brackett-Rozinsky via swift-users
To answer the original question: at file scope the access modifiers `private` and `fileprivate` have exactly the same effect. It does not matter which of them you use there. Nevin On Wed, Sep 28, 2016 at 12:14 PM, Marco S Hyman via swift-users < swift-users@swift.org> wrote: > > > On Sep 28,

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Marco S Hyman via swift-users
> On Sep 28, 2016, at 8:04 AM, Jens Alfke via swift-users > wrote: > > >> On Sep 28, 2016, at 12:16 AM, Cao Jiannan via swift-users >> wrote: >> >> I think the Swift team should tell us which is better. > > If one were better than the other,

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Dave Reed via swift-users
> On Sep 28, 2016, at 3:22 AM, Cao Jiannan via swift-users > wrote: > > Should I use private or fileprivate to declare global variables/consts in > Swift 3? e.g. > > fileprivate let a = 1 > fileprivate class SomeClass { > fileprivate b = 0 > } > > or > > private