[swift-users] Static type when expecting dynamic type

2017-02-01 Thread Howard Lovatt via swift-users
Hi All, Anyone know what is going on here: //: Closure picks up static type not dynamic class MutableReference { init() { guard type(of: self) != MutableReference.self else { fatalError("MutableReference is an abstract class; create a derrivative of

Re: [swift-users] Initializer accessing self

2017-02-01 Thread Ray Fix via swift-users
In the working version, I think the timer is first set to nil and then changed to the scheduled timer. In the non-working case time can only be set exactly once and self access is not legal until after it is set. Ray > On Feb 1, 2017, at 8:06 PM, Brandon Knope via swift-users >

[swift-users] Initializer accessing self

2017-02-01 Thread Brandon Knope via swift-users
I am at a loss: Why does this not work: class Test { let timer: Timer! init() { timer = Timer.scheduledTimer(timeInterval: 20, target: self, selector: #selector(test(_:)), userInfo: nil, repeats: true) } @objc func test(_ timer: Timer) { } } error:

Re: [swift-users] How to debug Segmentation Fault

2017-02-01 Thread Jim Ingham via swift-users
There is a Linux port of lldb, the swift enabled version of which is included in the toolchains that are built for Swift on Linux. gdb will do fine for the C side of the world, but it knows nothing about Swift. So if you need to see the swift side of the world to understand your crash, you'll

Re: [swift-users] How to debug Segmentation Fault

2017-02-01 Thread Jens Alfke via swift-users
> On Feb 1, 2017, at 5:00 PM, Maxim Veksler via swift-users > wrote: > > My method, though effective is probably barbaric. It's been years since I've > touched code that can actually seg fault, and I'm rusty on how you approach > debugging such cases, I'm wondering

Re: [swift-users] How to debug Segmentation Fault

2017-02-01 Thread Jens Alfke via swift-users
> On Feb 1, 2017, at 5:25 PM, I wrote: > > gdb is no longer used on Mac (we have lldb instead), so further discussion of > it would be off-topic here :) Oops, never mind that … I didn’t notice this was swift-users and thought it was one of the Apple mailing lists. *facepalm*

[swift-users] How to debug Segmentation Fault

2017-02-01 Thread Maxim Veksler via swift-users
I had some code work great on Mac and seg fault on Linux, bug demo[1] and bug report[2]. It took me some time to narrow it down using print()'s, essentially running a binary search to identify the point at which program election halts, leading to a seg fault. My method, though effective is