Re: [swift-users] Why can't Swift instance methods call class methods without qualification?

2016-07-02 Thread Nicholas Outram via swift-users
Good point. Again, from an educator perspective, one view is to think of the Class itself as a singleton object in memory, with its own set of iVars and methods that operate upon them. Although declared and defined in one source, when you visualise as objects / relationships in memory, one mode

Re: [swift-users] Why can't Swift instance methods call class methods without qualification?

2016-07-02 Thread Nicholas Outram via swift-users
You are right of course. I'm looking at this more from the eyes of an educator, where anything that reduces ambiguity helps. Students naively gravitating towards a singleton pattern is one of the battles I face. Some learners don't even properly understand the difference or risks. Invoking a

[swift-users] Swift DispatchSource not working

2016-07-02 Thread Darren Mo via swift-users
I am trying to catch SIGWINCH (terminal window size changed) in Swift 3 (Xcode 8). The following code should exit with a status of 1 when it receives SIGWINCH. But it never exits. ```swift // compile with `xcrun -sdk macosx swiftc sigwinch.swift` import Darwin import Dispatch let source = Disp

Re: [swift-users] Collection's "past the end" endIndex

2016-07-02 Thread Brent Royal-Gordon via swift-users
> On Jul 2, 2016, at 11:40 AM, Jens Alfke via swift-users > wrote: > > It’s hard to handle empty collections, otherwise. If endIndex were the last > valid subscript, then in an empty collection what would its value be? > Presumably it would have to point to one before the start, which is rathe

Re: [swift-users] Collection's "past the end" endIndex

2016-07-02 Thread Tim Vermeulen via swift-users
> On 2 Jul 2016, at 20:40, Jens Alfke wrote: > > >> On Jul 2, 2016, at 9:48 AM, Tim Vermeulen via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> Why is endIndex one greater than the last valid subscript argument, rather >> than simply the last valid subscript argument? I’m sure th

Re: [swift-users] Collection's "past the end" endIndex

2016-07-02 Thread Jens Alfke via swift-users
> On Jul 2, 2016, at 9:48 AM, Tim Vermeulen via swift-users > wrote: > > Why is endIndex one greater than the last valid subscript argument, rather > than simply the last valid subscript argument? I’m sure there are great > reasons for this, but I just can’t think of them myself. It’s hard t

[swift-users] Collection's "past the end" endIndex

2016-07-02 Thread Tim Vermeulen via swift-users
Why is endIndex one greater than the last valid subscript argument, rather than simply the last valid subscript argument? I’m sure there are great reasons for this, but I just can’t think of them myself. I’m implementing a binary tree and I want to implement BidirectionalCollection. Each index

[swift-users] Swift support for long double/Float80 math functions?

2016-07-02 Thread Antonino Ficarra via swift-users
How make Float80 bridge with long double math.h c functions? I resorts to use some orrible hacks like these: // in f80.h extern void sqrt_f80( void *result, const void *v ); extern void pow_f80( void *result, const void *v, const void *e ); ... // in f80.c void sqrt_f80( void *result, const voi

Re: [swift-users] Strong Reference Cycle

2016-07-02 Thread Zhao Xin via swift-users
Bar() will be released as soon as start(:)'s finishes execution. As there is no strong reference to Bar() and the closure runs inside of function start(:). steps: Bar() created execute Bar().start(:) with {print(self.object)} pass closure {print(self.object)} to start(:) closure runs inside of fu