[swift-users] It seems like we really need an #include preprocessor directive?

2017-03-11 Thread Edward Connell via swift-users
Observations about difining an object - Structs can't inherit and classes shouldn't inherit, final concrete types should be flat - Protocols need to be adopted by the final concrete type, otherwise constraint specializations aren't correctly applied This creates a really ugly code dup

Re: [swift-users] It seems like we really need an #include preprocessor directive?

2017-03-11 Thread Dave Reed via swift-users
> On Mar 11, 2017, at 3:12 PM, Edward Connell via swift-users > wrote: > > Observations about difining an object > • Structs can't inherit and classes shouldn't inherit, final concrete > types should be flat > • Protocols need to be adopted by the final concrete type, otherwise >

[swift-users] Memory Leak of Dictionary used in singleton

2017-03-11 Thread Ekaterina Belinskaya via swift-users
Hi everyone! I have singleton. It contains a 2 dictionaries. struct Stat { var statHash:String var displayDescription:String var displayName:String var displayIcon:String var statIdentifier:String } class Singleton { static let sharedInstance = Singleton() var stat

Re: [swift-users] Swift 3 segmentation error 11

2017-03-11 Thread Ben Cohen via swift-users
Hi – I think you’re hitting a bug that was fixed recently. There was a missing default for this particular combination’s slice type, which then interacted quite unpleasantly with a compiler bug to cause a crash. Can you try it with the latest Xcode beta? In the mean-time, adding the following t

Re: [swift-users] It seems like we really need an #include preprocessor directive?

2017-03-11 Thread Jens Alfke via swift-users
> On Mar 11, 2017, at 12:12 PM, Edward Connell via swift-users > wrote: > > It seems that an easy workaround would be an #include statement. > The boiler plate can be put in a separate file and included wherever it's > needed. IMHO this seems like a surefire ‘design smell’ — if you have a u

Re: [swift-users] It seems like we really need an #include preprocessor directive?

2017-03-11 Thread David Sweeris via swift-users
> On Mar 11, 2017, at 22:08, Jens Alfke via swift-users > wrote: > > (I see absolutely nothing wrong with inheritance, and it solves exactly this > sort of problem. Yes, structs can’t inherit, but they can contain a common > struct as a member, which is quite similar and addresses this issue.

Re: [swift-users] It seems like we really need an #include preprocessor directive?

2017-03-11 Thread Jens Alfke via swift-users
> On Mar 11, 2017, at 10:21 PM, David Sweeris wrote: > >> (I see absolutely nothing wrong with inheritance, and it solves exactly this >> sort of problem. Yes, structs can’t inherit, but they can contain a common >> struct as a member, which is quite similar and addresses this issue.) > > Tha

Re: [swift-users] It seems like we really need an #include preprocessor directive?

2017-03-11 Thread Rien via swift-users
> On 11 Mar 2017, at 21:12, Edward Connell via swift-users > wrote: > > Observations about difining an object > • Structs can't inherit and classes shouldn't inherit, final concrete > types should be flat Why? I always default to the position that we should do what works. Get the project

Re: [swift-users] It seems like we really need an #include preprocessor directive?

2017-03-11 Thread Edward Connell via swift-users
Putting a struct with your common vars in it seems like it wouldn't work, because now it is a member and the vars aren't exposed on your object directly, so the outer struct wouldn't conform to the protocols. My original problem with inheritance is that you can't correctly adopt a protocol on a ba