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

2016-09-29 Thread Michael Ilseman via swift-users
All access control modifiers have a degenerate case (roughly) equivalent to another one, and the typical wisdom for which to choose is to analyze your intent and perhaps future intent. “fileprivate” and “private” are identical at global scope. “internal” and “fileprivate” are identical in single

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

2016-09-29 Thread Quinn "The Eskimo!" via swift-users
On 28 Sep 2016, at 17:18, Nevin Brackett-Rozinsky via swift-users wrote: > 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. Right, but that doesn’t tell you which

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 : er

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” symbols, which the exampl

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, 2

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, they wouldn’t both exist... > > It depends on w

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

2016-09-28 Thread Jens Alfke via swift-users
> 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, they wouldn’t both exist... It depends on whether you need to use those entities in other source files in the same module. If you

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 let a = 1 > private clas

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

2016-09-28 Thread Cao Jiannan via swift-users
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 let a = 1 private class SomeClass { fileprivate b = 0 } Thanks! If they are identity, then I think the Swift team

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

2016-09-28 Thread Cao Jiannan via swift-users
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 let a = 1 private class SomeClass { private b = 0 } Thanks! If they are identity, then I think the Swift team shou

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

2016-09-28 Thread Cao Jiannan via swift-users
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 let a = 1 private class someClass { fileprivate b = 0 } Thanks! I think the Swift team should tell us which is bett