<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 2, 2016, at 1:08 PM, Joe Groff via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 2, 2016, at 1:00 PM, Philippe Hausler &lt;<a href="mailto:phausler@apple.com" class="">phausler@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">See:</div><div class=""><br class=""></div><a href="https://github.com/apple/swift-corelibs-foundation/blob/d015466450b2675037c6f1ace8e17e73050ccfb9/Foundation/NSURL.swift#L561" class="">https://github.com/apple/swift-corelibs-foundation/blob/d015466450b2675037c6f1ace8e17e73050ccfb9/Foundation/NSURL.swift#L561</a><div class=""><br class=""></div><div class="">This is far and few between of cases that it would be useful but there are a few APIs that we have not been able to express without being able to autorelease items. Most of which we have either forbidden in Linux or redesigned because they were sub-par swift experiences. However it seems reasonable to have a minimal shim to provide cross platform code compatibility even if it does next to nothing. That way trivial code as the original issue showed can easily be directly compiled on either platform without littering gnarly #ifdefs about.</div></div></div></blockquote></div><br class=""><div class="">In the fullness of time, the borrow model will hopefully give us a way to represent those kinds of "returns inner pointer" APIs safely in Swift without relying on dynamic lifetime extension, or awkward 'with { ... }' callbacks.</div></div></div></blockquote><br class=""></div><div>Not to mention using autoreleasepool to handle returns-inner-pointer isn't memory safe anyway. If the autorelease pool pops too soon then you end up with a dangling pointer that no amount of compiler analysis can detect.&nbsp;</div><br class=""><div class=""><br class=""></div><div class="">--&nbsp;</div><div class="">Greg Parker &nbsp; &nbsp; <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a> &nbsp; &nbsp; Runtime Wrangler</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>