Re: [swift-users] Capturing structs by reference

2016-07-24 Thread Tyler Fleming Cloutier via swift-users
return { print(self) } > } > > init() { > //self.x = { > //print(self) > //} > } > } > > let a = MyValueType() > a.x() // MyValueType() > > Zhaoxin > > On Sun, Jul 24, 2016 at 5:11 PM, Tyler Fleming Clo

Re: [swift-users] Capturing structs by reference

2016-07-24 Thread Tyler Fleming Cloutier via swift-users
Also if capture lists for structs do capture by value, how can I avoid the newly added error “Closure cannot implicitly capture a mutating self parameter” without changing the original reference semantics of MyValueType? Also why can’t I specify weak self for value types in capture lists if a c

[swift-users] Capturing structs by reference

2016-07-24 Thread Tyler Fleming Cloutier via swift-users
The Swift Programming Language book states: "Reference counting only applies to instances of classes. Structures and enumerations are value types, not reference types, and are not stored and passed by reference.” However consider the following example. func makeIncrementer() -> (() -> Int, ()

Re: [swift-users] Wrapping function declarations in #if swift()

2016-05-12 Thread Tyler Fleming Cloutier via swift-users
> On May 12, 2016, at 11:05 PM, Marco S Hyman wrote: > > On May 12, 2016, at 10:38 PM, Tyler Fleming Cloutier via swift-users > wrote: >> >> Hello everyone, >> >> It does seem like it is currently possible to wrap just the function >> decla

[swift-users] Wrapping function declarations in #if swift()

2016-05-12 Thread Tyler Fleming Cloutier via swift-users
Hello everyone, It does seem like it is currently possible to wrap just the function declaration in an #if swift() directive like so: #if swift(>=3.0) public func add(filter filterName: String, path: String) { #else // ERROR Expected ‘}’ at end of brace statement public func addFilter(filterName

Re: [swift-users] Illegal Instruction: 4 OS X libdispatch

2016-05-03 Thread Tyler Fleming Cloutier via swift-users
via swift-users > wrote: > > > On 1 May 2016, at 19:33, Tyler Fleming Cloutier via swift-users > wrote: > >> I’m creating a Swift package that uses Dispatch on OS X, but I am getting an >> Illegal Instruction error after I register my block for an event. >>

Re: [swift-users] Server side swift application ?

2016-05-01 Thread Tyler Fleming Cloutier via swift-users
Hi Raphael, I took a look at the current Kitura (Swift-IBM) code and they appear to be using libdispatch, but only to put there blocking calls off the main queue: https://github.com/IBM-Swift/Kitura-net/blob/master/Sources/KituraNet/HttpServerSpi.swift#L52. This might be because libdispatch o

[swift-users] Illegal Instruction: 4 OS X libdispatch

2016-05-01 Thread Tyler Fleming Cloutier via swift-users
Hi everyone, I’m creating a Swift package that uses Dispatch on OS X, but I am getting an Illegal Instruction error after I register my block for an event. Specifically, a UD2 instruction inside of libdispatch: Process 16425 stopped * thread #1: tid = 0x68d099, 0x7fff814aa360 libdispatch.d