> On Jun 20, 2016, at 11:24 AM, Anton Zhilin via swift-evolution > <swift-evolution@swift.org> wrote: > Trent Nadeau via swift-evolution <swift-evolution@...> writes: > >> https://github.com/tanadeau/swift-evolution/blob/make-noescape- > default/proposals/XXXX-make-noescape-default.md > > -1 from me. > > 1. One must break API and ABI compatibility to add @escaping to an > existing function > 2. @nonescaping case is actually quite as common as @escaping > 3. Swift's lifetime system is not powerful enough, I'll explain below > > Lazy map and filter will be marked as @escaping. Now consider the > following code: > > func sum<T>(_ array: [T], transform: (T) -> Int) -> Int { > return array.lazy.map(func).reduce(0, combine: +) > } > > `transform` will be marked as @escaping, despite that `transform` never > actually escapes `sum`.
This is a really good point. In the short term, we can address this with an unsafe nonescaping-to-escaping construct, but we'll need a more complete answer eventually. John. _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution