<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Dec 8, 2015 at 9:42 AM, Joe Groff <span dir="ltr">&lt;<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">COpaquePointer is IMO a vestige that should be eliminated completely. We&#39;d ultimately like to import opaque C structs as distinct, non-constructible types in Swift, so that they can still be well-typed UnsafePointer&lt;OpaqueThing&gt; types in Swift.<div><br></div><div>-Joe</div></div></blockquote><div><br></div><div>That would be nice. But there is still the &quot;context pointer&quot; use case, where conversions to/from UnsafePointer&lt;Void&gt; are needed. Would it make sense for the Unmanaged type to deal in UnsafePointer&lt;Void&gt;, rather than COpaquePointer?</div><div><br></div><div><br></div><div>On Tue, Dec 8, 2015 at 9:37 AM, John McCall <span dir="ltr">&lt;<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><blockquote type="cite"><div>- Add implicit conversion from COpaquePointer to Unsafe(Mutable)Pointer&lt;Void&gt;, and/or vice versa.<br></div></blockquote></span></div><div><span class=""><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div><br></div><div>- Even better, add implicit conversion from Unmanaged&lt;T&gt; to COpaquePointer or UnsafePointer&lt;Void&gt;, behaving the way toOpaque() currently does. Also, replace Unmanaged.fromOpaque() with an initializer Unmanaged(_: UnsafePointer&lt;Void&gt;).</div></div></div></blockquote><div><br></div></span>We try very hard to avoid adding new implicit conversions.</div><span class=""><font color="#888888"><div><br></div><div>John.</div></font></span></div></blockquote><div><br></div><div>My impression is that Unmanaged is pretty much only used for cases like this. It seems a bit redundant given that UnsafePointer exists, and converting between them is tedious as a user. Would it make sense to move the passUnretained/takeRetainedValue/etc. functions onto UnsafePointer?</div></div></div></div></div>