[swift-evolution] Allow partial applications of mutating methods in @noescape contexts
Tim Vermeulen
tvermeulen at me.com
Fri May 27 14:17:58 CDT 2016
struct MyStruct {
var count = 0
mutating func add(amount: Int) {
count += amount
}
}
var myStruct = MyStruct()
[1, 2, 3, 4].forEach(myStruct.add)
This code currently doesn’t compile because myStruct.add is a partial application of a mutating method, which is forbidden. However, in my understanding, this cannot cause problems inside forEach because its body is marked @noescape. So, could we allow partial applications of mutating methods in @noescape contexts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160527/5d0276b4/attachment.html>
More information about the swift-evolution
mailing list