[swift-users] protocol where clause problem

2017-01-11 Thread adelzhang via swift-users
hello all! I'm wondering if somebody can explain following snippet to me. protocol P { associatedtype Element func next() -> Element } protocol Q { associatedtype T : P func makeT() -> T } extension Q where Self.T == Self { func makeT

Re: [swift-users] [unrelated-to-swift] an issue with structs in C++?

2017-01-11 Thread Saagar Jha via swift-users
Looks like someone’s trying to solve the Mt. Chiliad Mystery :) Anyways, it appears that “Epsilon Building” has 5 members instead of 4. That’s probably causing the issue. Saagar Jha > On Jan 11, 2017, at 8:46 PM, Ethin Probst via swift-users > wrote: > > Hello all, > I have the following str

[swift-users] [unrelated-to-swift] an issue with structs in C++?

2017-01-11 Thread Ethin Probst via swift-users
Hello all, I have the following structured array: static struct { LPCSTR text; float x; float y; float z; } lines[5] = { { "MARKER" }, { "MICHA

[swift-users] Strange behavior creating Double from String on Mac and Linux

2017-01-11 Thread Krystof Beuermann via swift-users
Hi Guys, i just stumbled over this different behavior between Mac and Linux: MacOS Sierra 10.12.1 Swift 3.0.2 REPL  1> import Foundation   2. let nf = NumberFormatter()   3. print(nf.string(for: (Double("1")?.rounded()) as Any) as Any)   4. print(nf.string(for: (Double("1")!.rounded()) as Any)

Re: [swift-users] [swift-evolution] Best way to handle escaping function that might throw

2017-01-11 Thread Howard Lovatt via swift-users
Yes, I have used Result in the past. In this case I wanted to use throws because that is what functions like map do. Looks like I will have to stick with throwing, not too bad since the overhead is reasonably low. On Wed, 11 Jan 2017 at 8:03 am, T.J. Usiyan wrote: > I suggest using an enum to

Re: [swift-users] [swift-evolution] Best way to handle escaping function that might throw

2017-01-11 Thread Howard Lovatt via swift-users
Another possibility, other than generics, would be to drop rethrows all together and have the compiler infer if a throw is possible or not, including: struct FStore { let f: () throws -> Void func call() throws { try f() } } The compiler can make two versions, one if f can

Re: [swift-users] for i in 0...UInt8.max

2017-01-11 Thread Quinn "The Eskimo!" via swift-users
On 11 Jan 2017, at 13:06, tuuranton--- via swift-users wrote: > These codes used to crash in earlier Swifts. Can you explain why? We now have the notion of `ClosedRange`, which can represent all values in an integer type (at the cost of introducing the complexity of two different range types

[swift-users] for i in 0...UInt8.max

2017-01-11 Thread tuuranton--- via swift-users
I'm looking at Swift 3.0.1 now. This code works fine: for i in 0..___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

Re: [swift-users] CNLabeledValue var

2017-01-11 Thread German Laullon via swift-users
Thanks, var toExcludeOrCopy : AnyObject? Could help me on some cases... But if I try this: var props = [AnyObject]() props += contact.phoneNumbers ( "contact" is as CNContact, so "contact.phoneNumbers" is [CNLabeledValue] ) I get this error: /Users/laullon/xcode/bipo/BiPo/MergePreview.swift:8

Re: [swift-users] C-function not found by linker

2017-01-11 Thread Rien via swift-users
Sometimes you just have to post a stupid question to see what you did wrong :-( So please disregard…. PS: it was of course the “static” (I have no clue why I did put that in there… oh well) Regards, Rien Site: http://balancingrock.nl Blog: http://swiftrien.blogspot.com Github: http://github.c

[swift-users] C-function not found by linker

2017-01-11 Thread Rien via swift-users
My project uses openSSL and that works fine. I needed one specific function that cannot be accessed from Swift directly, so I created a C-file for that. (both .h and .c file) The function is found during compilation. But is then reported as “unused” and the linker reports “missing function”. A