Re: [swift-users] DispatchQueue.async within infinite loop

2017-10-04 Thread Jeremy W. Sherman via swift-users
Something has to drain blocks sent to the main queue. You can run a Foundation run loop. That should drain the main queue. I believe it also ensures blocks sent to the main queue always run on the main thread. Dispatch includes its own lower-level function to pump the main queue:

Re: [swift-users] Detect if a generic type is numeric

2017-10-04 Thread Kevin Lundberg via swift-users
Scratch that, that won't work for the runtime type: isNumeric(0 as Any) == false // :( On 10/4/2017 9:30 PM, Kevin Lundberg via swift-users wrote: > > Can you do something like this? > > func isNumber(_ value: T) -> Bool { return true } > > func isNumber(_ value: T) -> Bool { return false } > >

Re: [swift-users] Detect if a generic type is numeric

2017-10-04 Thread Kevin Lundberg via swift-users
Can you do something like this? func isNumber(_ value: T) -> Bool { return true } func isNumber(_ value: T) -> Bool { return false } I don't recall whether or not swift will pick the right version of the function here, or whether this can even compile (mac isnt open at the moment), but if you

Re: [swift-users] DispatchQueue.async within infinite loop

2017-10-04 Thread Rahul Ranjan via swift-users
Hi Geordie, I am new here and so pardon me if I misunderstood anything. When you run a program in Swift, it already runs on main thread by default and then you can all Dispatch async. So for example, while true { // This while loop will run for infinite on main thread Dispatch.main.async {} //

[swift-users] Where CodingKey protocol is implemented on swift source code

2017-10-04 Thread Solli Honorio via swift-users
Studying "Codable.swift" and "JSONEncoder.swift" to understand how decoding works under the hood, I got confused about how CodingKey is implemented for 'enum'. Shouldn't have an extension of RawRepresentable to implement the CodingKey protocol? This is the answer I'm looking for, how the

Re: [swift-users] Communicating with dynamically loaded swift library

2017-10-04 Thread Joe Groff via swift-users
> On Oct 4, 2017, at 11:02 AM, Ján Kosa via swift-users > wrote: > > Hello folks, > > I have been toying with dynamic libraries, trying to implement plugin > functionality. I was able to get to the point where I can call simple > function in loaded library, but I am

Re: [swift-users] Communicating with dynamically loaded swift library

2017-10-04 Thread Daniel Dunbar via swift-users
The way that I have done this in the past is pass a protocol as an unsafe pointer to an exposed entry point: ```swift let entryPoint = dlsym(handle, “initializePlugin”) guard entryPoint != nil else { fatalError("missing plugin entry point: \(pluginPath)")

[swift-users] Communicating with dynamically loaded swift library

2017-10-04 Thread Ján Kosa via swift-users
Hello folks, I have been toying with dynamic libraries, trying to implement plugin functionality. I was able to get to the point where I can call simple function in loaded library, but I am having troubles starting more sophisticated communication channel. There are 3 projects - PluginConsumer

Re: [swift-users] Type inference issue with map and filter chained

2017-10-04 Thread Mark Lacey via swift-users
> On Sep 24, 2017, at 1:52 AM, Trevör ANNE DENISE via swift-users > wrote: > > Hello everyone, I found this on StackOverflow : > https://stackoverflow.com/questions/46381752/swift-4-methods-chaining/ >

Re: [swift-users] Netlib

2017-10-04 Thread Edward Connell via swift-users
Hi Vladimir, To answer your questions: 1) The framework is designed to allow the easy creation of models for training and inference. The framework is intended to be used both for training and deployment on all platforms. 2) Yes currently only the CudaComputeService is implemented. I am only one

Re: [swift-users] Is URLSession actually working on Linux

2017-10-04 Thread Alex Blewitt via swift-users
> On 3 Oct 2017, at 19:15, Geordie Jay via swift-users > wrote: > > 2017-10-03 20:10 GMT+02:00 Georgios Moschovitis via swift-users > >: > I implemented a simple RSS feed aggregator. I used code like... > > let data

Re: [swift-users] Wrapping ImageMagick in a Swift Package

2017-10-04 Thread Toni Suter via swift-users
Hi Ankit, Thank you very much! It works now :-) Best regards, Toni > Am 03.10.2017 um 21:50 schrieb Ankit Aggarwal : > > Hi Toni, > > You're not supposed to build the system module package (because there is > nothing to build). Tag and add this package as a