Re: [swift-users] Referencing Swift Functions from the Objective-C Runtime

2016-11-18 Thread Jacob Bandes-Storch via swift-users
I imagine unsafeBitCast would be the way to go here. But are you assuming that all of the instance methods have type "(Foo) throws -> Void" ? Or do you somehow want to dynamically use the type information? Jacob On Fri, Nov 18, 2016 at 10:37 PM, Jeff Kelley via swift-users < swift-users@swift.org

[swift-users] Referencing Swift Functions from the Objective-C Runtime

2016-11-18 Thread Jeff Kelley via swift-users
Hello, I’m trying to enumerate the methods of a class in Swift using the Objective-C runtime. Everything is working fine so far, except for the very last step. Suppose I have a Swift class like this: class Foo: SomeSuperclass { @objc func bar() { print("Hello, World!")

Re: [swift-users] hello, first time poster and accelerate question

2016-11-18 Thread Jacob Bandes-Storch via swift-users
Can't you achieve this with a single vector*matrix multiplication? [1/n, 1/n, ..., 1/n] * A = [mean(col 1); mean(col 2); ...; mean(col n)] Or in more legible form: [image: Inline image 1] Jacob On Fri, Nov 18, 2016 at 5:36 AM, Yuma Decaux via swift-users < swift-users@swift.org> wrote: >

Re: [swift-users] Question on windows version

2016-11-18 Thread Eric Wing via swift-users
On 11/17/16, John MacLean via swift-users wrote: > Hello, > > I am running Win10 64 and tried the windows version following the > instructions. What I do is select the swift file – click compile and I get > this error > > The system cannot find the path specified. > '"link"' is not recognized as

Re: [swift-users] Protocol Initializer Inheritance

2016-11-18 Thread Jordan Rose via swift-users
I think this is a known issue. You can work around it by jumping through another function: import Foundation protocol MyProtocol { init(foo: Int, bar: String) } class MyOperation: Operation, MyProtocol { required init(foo: Int, bar: String) { super.init() } } private func makeMyProtoHel

[swift-users] Protocol Initializer Inheritance

2016-11-18 Thread Bradley Zeller via swift-users
I am trying to construct an object that conforms to a protocol `A` and also sublclasses object `B`. Protocol `A` requires an initializer that will be used to construct it. Xcode will attempt to autocomplete the initializer but then ultimately gives the following error: `error: argument passed

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread John McCall via swift-users
> On Nov 18, 2016, at 3:10 PM, Karl wrote: > > >> On 18 Nov 2016, at 20:18, John McCall > > wrote: >> >>> >>> On Nov 18, 2016, at 7:40 AM, Karl >> > wrote: >>> >>> On 18 Nov 2016, at 13:05, Adrian Zubarev via swift-users mailt

Re: [swift-users] NSJSONSerialization barfs writing a Dictionary parsed from JSON: "Invalid type in JSON write (_SwiftValue)"

2016-11-18 Thread Tony Parker via swift-users
FYI, here is the GitHub commit that addressed this issue: https://github.com/apple/swift/commit/1f11ef2fd29f214bd9d9a5fa85246d36c04448f0 It was also reported as SE-0140. Basically, optional values were getting brid

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Karl via swift-users
> On 18 Nov 2016, at 20:18, John McCall wrote: > >> >> On Nov 18, 2016, at 7:40 AM, Karl > > wrote: >> >> >>> On 18 Nov 2016, at 13:05, Adrian Zubarev via swift-users >>> mailto:swift-users@swift.org>> wrote: >>> >>> Hi there, >>> >>> I just can’t get my head aro

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Adrian Zubarev via swift-users
Hi John, Thank you for your huge and informative answer. Only after reading it I’ve realized that I made a couple mistakes in my code snippets. Thank you for correcting me. :) I also have done some further digging and found a thread [swift-dev] [idle] COW wrapper in 30 lines which explains a f

Re: [swift-users] NSJSONSerialization barfs writing a Dictionary parsed from JSON: "Invalid type in JSON write (_SwiftValue)"

2016-11-18 Thread Dan Loewenherz via swift-users
I've encountered a similar bug and filed a radar a few months ago. My report was marked as a duplicate but besides that I haven't received any follow-up. It does appear to have been fixed in Xcode 8.1 / Swift 3.0.1. http://www.openradar.me/28365419 Essentially, NSJSONSerialization would (does?) cr

[swift-users] NSJSONSerialization barfs writing a Dictionary parsed from JSON: "Invalid type in JSON write (_SwiftValue)"

2016-11-18 Thread Jens Alfke via swift-users
A developer using the framework I work on just reported an exception which is triggered by NSJSONSerialization (see backtrace below.) Basically an NSDictionary gets parsed from JSO

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread John McCall via swift-users
> On Nov 18, 2016, at 7:40 AM, Karl wrote: > > >> On 18 Nov 2016, at 13:05, Adrian Zubarev via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> Hi there, >> >> I just can’t get my head around mutable views and COW. >> >> Here is a small example: >> >> final class Storage { >>

Re: [swift-users] [swift-build-dev] SwiftPM Test Fixtures

2016-11-18 Thread Daniel Dunbar via swift-users
The way that we have been doing this is by using `#file` to derive the location of the test data. It is gross, but it works until we have a real resource story. - Daniel > On Nov 17, 2016, at 7:07 PM, Ryan Lovelett via swift-build-dev > wrote: > > If I have a number of `*.json` files that ar

[swift-users] Question on windows version

2016-11-18 Thread John MacLean via swift-users
Hello, I am running Win10 64 and tried the windows version following the instructions. What I do is select the swift file – click compile and I get this error The system cannot find the path specified. '"link"' is not recognized as an internal or external command, operable program or batch fil

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Adrian Zubarev via swift-users
What exactly to you mean by unsafe/invalide? If you refer to unowned than yes this is incorrect. That was only part of the first question about isKnownUniquelyReferenced, where I myself missed the part from the docs that says that weak references don’t affect the result. In general DocumentValu

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Karl via swift-users
> On 18 Nov 2016, at 16:40, Karl wrote: > > >> On 18 Nov 2016, at 13:05, Adrian Zubarev via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> Hi there, >> >> I just can’t get my head around mutable views and COW. >> >> Here is a small example: >> >> final class Storage { >>

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Karl via swift-users
> On 18 Nov 2016, at 13:05, Adrian Zubarev via swift-users > wrote: > > Hi there, > > I just can’t get my head around mutable views and COW. > > Here is a small example: > > final class Storage { > > var keys: [String] = [] > var values: [Int] = [] > } > > public struct Docume

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Adrian Zubarev via swift-users
Nah it’s okay mate. ;) This is the right list, because I ask for help. COW stands for copy-on-write. If you’re interesting on learning something new, read this paragraph https://github.com/apple/swift/blob/7e68e02b4eaa1cf44037a383129cbef60ea55d67/docs/OptimizationTips.rst#advice-use-copy-on-writ

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Zhao Xin via swift-users
Sorry. If you are doing something on implementing proposals, you should use [swift-dev] list instead. Yes. I do don't know what the COW means. Zhaoxin On Fri, Nov 18, 2016 at 11:09 PM, Adrian Zubarev < adrian.zuba...@devandartist.com> wrote: > I’m sorry but you seem not to understand what I’m as

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Zhao Xin via swift-users
protocol Copyable { func copy() -> Self } final class Storage:Copyable { var keys: [String] = [] var values: [Int] = [] func copy() -> Storage { let s = Storage() s.keys = keys s.values = values return s } } public struct Docu

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Adrian Zubarev via swift-users
I’m sorry but you seem not to understand what I’m asking for! If you don’t know what a mutable view is, please read this proposal to get the basic idea: https://github.com/natecook1000/swift-evolution/blob/nc-dictionary-collections/proposals/-dictionary-key-and-value-collections.md Your ans

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Adrian Zubarev via swift-users
Ups sorry for CCing the post to the evolution list. That happens from time to time. :/ --  Adrian Zubarev Sent with Airmail Am 18. November 2016 um 15:07:43, Adrian Zubarev (adrian.zuba...@devandartist.com) schrieb: I apologize about the weak/unowned issue I mentioned. I kinda missed that p

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Adrian Zubarev via swift-users
This doesn’t make any sense. Somewhere from the Swift book: Weak and unowned references enable one instance in a reference cycle to refer to the other instance without keeping a strong hold on it. The instances can then refer to each other without creating a strong reference cycle. From the sdl

Re: [swift-users] Problem with mutable views and COW

2016-11-18 Thread Zhao Xin via swift-users
>Why is the second check false, even if the property is marked as unowned for the view? Please search the mailing list, this is not the first time it comes as a new question. Shortly speaking, it is `false` only because you used `unowned`. If you you can grantee it always exists. Just use it direc

[swift-users] hello, first time poster and accelerate question

2016-11-18 Thread Yuma Decaux via swift-users
Hello everyone, Nice to meet y'all, and here's my first question: I am currently setting a semantically easy to use accelerate operation extension set for my research. I have done all the basic operations, vector to scalar, vector to vector, matrix mult matrix, transpose etc, but would like to

[swift-users] Problem with mutable views and COW

2016-11-18 Thread Adrian Zubarev via swift-users
Hi there, I just can’t get my head around mutable views and COW. Here is a small example: final class Storage { var keys: [String] = [] var values: [Int] = [] } public struct Document { var _storageReference: Storage public init() { self._stor