I disagree with dropping function references in general, but I do agree with limiting partially applied method references.
In @escaping arguments, adding self. won’t add enough evidence that it actually creates a closure with capture. Even in non-escaping context, I find plain method references odd: func square(_ x: Int) -> Int { … } (1...10).map(square) // totally ok with that class SomeClass { func foo(_ x: Int) -> Int { … } func bar() { (1...10).map(foo) // what?? (1...10).map(self.foo) // ok someControl.addHandler(self.foo) // should be error if @escaping? } } 2017-03-04 10:09 GMT+03:00 David Hart via swift-evolution < swift-evolution@swift.org>: I encountered this precise memory leak in my code a few days ago, so I > sympathize. A second solution would be to drop function references. I think > a core team member suggested it on another thread.
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution