<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></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 Dec 19, 2015, at 5:04 PM, T.J. Usiyan via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Would `consumeReleased` work at all? It captures the 'don't use this again' aspect and 'release' without much extra.</div></div></blockquote><div><br class=""></div>Unfortunately that name seems to imply &nbsp;you're consuming something that has already been released. &nbsp;You're actually consuming a retain that happened in the CF function.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sat, Dec 19, 2015 at 7:45 PM, Rainer Brockerhoff via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 18/12/15 16:46 , <a href="mailto:swift-evolution-request@swift.org" class="">swift-evolution-request@swift.org</a> wrote:<br class="">
&gt; Date: Fri, 18 Dec 2015 11:38:31 -0800<br class="">
&gt; From: Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>&gt;<br class="">
&gt; Subject: Re: [swift-evolution] RFC: Proposed rewrite of Unmanaged&lt;T&gt;<br class="">
&gt; Message-ID: &lt;<a href="mailto:E82AADA9-F4A4-4E4E-98C3-6E9A3CEC4D12@apple.com" class="">E82AADA9-F4A4-4E4E-98C3-6E9A3CEC4D12@apple.com</a>&gt;<br class="">
<span class="">&gt;<br class="">
&gt;&gt; &gt; On Dec 17, 2015, at 6:23 PM, T.J. Usiyan &lt;<a href="mailto:griotspeak@gmail.com" class="">griotspeak@gmail.com</a>&gt; wrote:<br class="">
&gt;<br class="">
&gt;&gt; &gt; My main point of contention with `.release()` is that it has the *exact* same name as a method from the MRC strategy. Maybe this is a silly point, but this overlap could further complicate teaching how ARC works and in what ways it is based on MRC conventions.<br class="">
&gt;&gt; &gt; I am not of the opinion that ARC is fundamentally more difficult to understand than MRC, but I do believe that it takes a very particular kind of faith now that we don't get to manually write the retains and releases. This is completely worth it, in my opinion, but&nbsp; I want to avoid making it *more* confusing to explain what ARC doing at compile time.<br class="">
</span><span class="">&gt; Well, unsafeRef.release() is equivalent to<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp;{<br class="">
&gt;&nbsp; &nbsp; &nbsp;let x = $0.object<br class="">
&gt;&nbsp; &nbsp; &nbsp;CFRelease($0) // if CFRelease() wasn't @unavailable<br class="">
&gt;&nbsp; &nbsp; &nbsp;return x<br class="">
&gt; }(unsafeRef)<br class="">
&gt;<br class="">
&gt; If you let the return value drop on the floor, it ends up being<br class="">
&gt; exactly equivalent to the method with the exact same name from the<br class="">
&gt; MRC strategy.&nbsp; So the correspondence is strong and shouldn’t be a<br class="">
&gt; problem.&nbsp; That’s just my opinion, though, and part of the reason<br class="">
&gt; we’re asking for feedback here is so people steeped in MRC like you<br class="">
&gt; can argue with me about that :-), so if you find this unconvincing<br class="">
&gt; please explain why.<br class="">
<br class="">
</span>OK, guess I qualify as "steeped" there - I still use MRC in all my<br class="">
shipping apps, although I've tentatively used ARC in small fry like<br class="">
build-time utilities. (Never got used to GC.)<br class="">
<br class="">
Anyway, much of my code looks like one of these patterns:<br class="">
<br class="">
// 1<br class="">
NSDictionary* dict = [(id)CFCreateSomeCFDictionary() autorelease];<br class="">
... use dict for some lines, done<br class="">
<br class="">
// 2<br class="">
NSArray* array = (NSArray*)CFGetSomeCFArray();<br class="">
... use array for some lines, done<br class="">
<br class="">
// 3<br class="">
NSString* str = (NSString*)CFCreateSomeCFString();<br class="">
... use str for some lines<br class="">
[release str];<br class="">
<br class="">
One thing about my not migrating to ARC is that I find the bridging cast<br class="">
names opaque - can't memorize them! Same, sadly, was true for the<br class="">
Umanaged&lt;T&gt; methods.<br class="">
<br class="">
So I'd say, use `.release` or `.autorelease` if they'd be used in the<br class="">
same place as above...<br class="">
<span class="HOEnZb"><font color="#888888" class=""><br class="">
--<br class="">
Rainer Brockerhoff&nbsp; &lt;<a href="mailto:rainer@brockerhoff.net" class="">rainer@brockerhoff.net</a>&gt;<br class="">
Belo Horizonte, Brazil<br class="">
"In the affairs of others even fools are wise<br class="">
In their own business even sages err."<br class="">
<a href="http://brockerhoff.net/blog/" rel="noreferrer" target="_blank" class="">http://brockerhoff.net/blog/</a><br class="">
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</div></div></blockquote></div><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=JfMPa-2F7wwZPzsZ3QKA8NjtONIYX4SjbWuUxtpfsTY2j7iKyyNoCjRvZZvWJq7yuxWav7DNVChylE7IwiqQIxtz5HRrKy0M6yxTaGgOetMMicQjGmfrabhSr-2FTQh6EeivlVK0XQXe2YhT9kNlGo670HXMxAVrpkG2Kxdrs4ADYTLfSVbjk2E-2FNQzjSzrNSpEfLUSSYo75EdempPc5rcRq36E0EFfCCBZqaM-2F-2FxHvVt9I-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-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""><div class="">
-Dave<div class=""><br class=""></div><br class="Apple-interchange-newline">

</div>
<br class=""></body></html>