Re: [swift-users] Exclamation mark's in swift parameter listings?

2017-01-18 Thread Slava Pestov via swift-users
Boxing usually refers to out-of-line allocation of values on the heap. For example, values of protocol type (as well as Any) will box their payload, depending on size. Slava > On Jan 18, 2017, at 10:53 PM, Rien wrote: > > Thanks Slava, > > Then my memory wasn’t that

Re: [swift-users] Strange Error about Default values

2017-01-18 Thread Zhao Xin via swift-users
Maybe what you want is struct S1 { private var _v = 1 var v:Int { get { return self._v } } } Zhaoxin On Thu, Jan 19, 2017 at 2:08 AM, Jordan Rose via swift-users < swift-users@swift.org> wrote: > It is a terrible error message, though. I've filed

Re: [swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Adrian Zubarev via swift-users
PS: If we’re talking about iOS here than public and open makes less sense as long as you’re not writing a framework for iOS. Each type that is considered to be used in other projects can be seen as an own module, only then access modifiers like public or open makes some sense again. ;) -- 

Re: [swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Shawn Erickson via swift-users
Yeah I am fairly sure that is by design. A lot of swifts access controls are about getting you up and going with little work / boilerplate while internal to your model while requiring you to be explicit about what you want to expose publicly outside of your module. On Wed, Jan 18, 2017 at 8:40 AM

Re: [swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Adrian Zubarev via swift-users
I feel like I’ve seen this discussion somewhere on the mailing list before. If I remember correctly or it could be only me, this behavior is by design, because you don’t want to open your API implicitly to everyone. Internally it won’t hurt your module, but only allow you to write less code and

Re: [swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Kevin Nattinger via swift-users
I ran into this issue not half an hour ago; I would also prefer the default initializer to default to the entity’s access level, or at least have some simple way of opting in. > On Jan 18, 2017, at 3:33 PM, Dave Reed via swift-users > wrote: > > I’m teaching an iOS

Re: [swift-users] Strange Error about Default values

2017-01-18 Thread Adrian Zubarev via swift-users
Computed properties do not have any default values. That said, you can only use didSet or willSet on properties like yours to observe them or remove the default value from the computed property completely to use get and set. --  Adrian Zubarev Sent with Airmail Am 18. Januar 2017 um

[swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Dave Reed via swift-users
I’m teaching an iOS with Swift this semester and one of my students pointed out that: struct Person { var firstName: String var lastName: String } does create a default initializer that you can call as: p = Person(firstName: “Dave”, lastName: “Reed”) but if you write: public struct

[swift-users] Migrating to SPM, best practise?

2017-01-18 Thread Rien via swift-users
I have a small sockets based framework on Github (SwifterSockets). It was created before SPM existed. The next update is planned, and I want to move to SPM. 1) How to create a package around the old xcode project? 2) I am unsure how to move from the old git structure to the new. What would be

[swift-users] Strange Error about Default values

2017-01-18 Thread Wang LiMing via swift-users
In latest Xcode(8.2.1), playground struct S1 { var v = 1 { get { // report Error: Use of unresolved identifier ‘get' return self.v.// report Error: Use of unresolved identifier ‘self' } } I can’t found the reason about the error.