<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Jacob,<div class=""><br class=""></div><div class="">Thanks for bringing the discussion on this topic here.</div><div class=""><br class=""></div><div class="">One topic I wanted to discuss was finding a comprehensive list of API that needs the attribute. The next step after that is figuring out how to get this attribute to be consistent across Darwin and Swift open source.</div><div class=""><br class=""></div><div class="">One option was to use the API notes feature of the compiler to annotate these APIs as part of the import into Swift. Another is to get the C headers changed (on Darwin too) to add the attribute. We may want to do one approach in the short term and another in the long term.</div><div class=""><br class=""></div><div class="">- Tony</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 5, 2015, at 12:53 PM, Jacob Bandes-Storch via swift-corelibs-dev &lt;<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">There are several functions in public API, such as dispatch_sync and dispatch_apply, which do not allow their block parameters to escape the function call.</div><div class=""><br class=""></div><div class="">However, they are not currently exposed to Swift as @noescape, meaning that users are required to specify "self." or "[weak self]" in their closures.</div><div class=""><br class=""></div><div class="">The instances I can think of:</div><div class=""><br class=""></div><div class="">- dispatch_sync</div><div class="">- dispatch_barrier_sync</div><div class="">- dispatch_apply</div><div class="">-&nbsp;dispatch_block_perform (thanks to Pierre Habouzit for pointing this out)</div><div class=""><br class=""></div><div class="">I provided a preliminary implementation at <a href="https://github.com/apple/swift-corelibs-libdispatch/pull/6" class="">https://github.com/apple/swift-corelibs-libdispatch/pull/6</a>, but it needs refinement. Tony Parker mentioned commented that there might be similar changes to make for the&nbsp;swift-corelibs-foundation project.</div><div class=""><br class=""></div><div class="">Thoughts?</div><div class=""><br class=""></div><div class="">Question: does __attribute__((noescape)) have the same meaning when applied to C function pointers? Namely, does Swift understand @noescape as it applies to @convention(c)?</div><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class="">Jacob Bandes-Storch<br class=""></div></div></div></div>
</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=U7z7oSqRMSwdl2rYt9JJ4zIFaeg4R-2FxExg9xndDuCbzf-2B2QmL43cDOCILdRnGs1UDs25uaFBppUdY-2FimgiomHAt0HedxZixFOsZSO-2F4vQ41RqYJT-2FvoAjI-2BBtcRiKwigVDwo0jLVETk3oqafqtGgwhdrZI9prroZLQZzVB-2FKE9t6-2Bz-2FJyd76F-2FYXbCtuBorjkY59fJVlpniF841e-2F3DUiCSr3uFQBY6iMakuM4StDRU-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<br class="">swift-corelibs-dev mailing list<br class=""><a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev<br class=""></div></blockquote></div><br class=""></div></body></html>