[swift-evolution] State of @noescape ?

John McCall rjmccall at apple.com
Mon Jun 20 13:12:55 CDT 2016


> On Jun 20, 2016, at 10:55 AM, Антон Жилин via swift-evolution <swift-evolution at swift.org> wrote:
> IIRC, there were at least the following counter-arguments:
> 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
> 
> Frankly speaking, I support both of this arguments. I'll also add another counter-argument.
> 
> 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`.
> 
> I believe that we should not accept nonescaping-by-default until we get a powerful lifetimes system, as in Rust.

> 
> I think it makes sense to create a mini-proposal just for renaming of @noescape to @nonescaping.

There is already a thread for this conversation; please respond there.

John.

> 
> - Anton
> 
> 2016-06-20 20:37 GMT+03:00 Austin Zheng <austinzheng at gmail.com <mailto:austinzheng at gmail.com>>:
> Trent Nadeau had prepared a proposal on Chris Lattner's recommendation, and there was a discussion thread a few weeks back: http://thread.gmane.org/gmane.comp.lang.swift.evolution/19756 <http://thread.gmane.org/gmane.comp.lang.swift.evolution/19756>.
> 
> Not sure what the outcome was. I don't see any open PRs to merge the proposal into the swift-evolution repo.
> 
> Austin
> 
> On Mon, Jun 20, 2016 at 9:06 AM, Антон Жилин <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> Hmm, I guess you are right, there would be no point keeping @nonescaping, then.
> 
> - Anton
> 
> 2016-06-20 18:55 GMT+03:00 David Waite <david at alkaline-solutions.com <mailto:david at alkaline-solutions.com>>:
> 
>> On Jun 20, 2016, at 9:39 AM, Антон Жилин via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> * Rename @noescape to @nonescaping, and make @nonescaping the default case
> Do you mean replace @noescape with its opposite, @escaping?
> 
> -DW
> 
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160620/04a4af7a/attachment.html>


More information about the swift-evolution mailing list