<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 May 12, 2016, at 9:27 AM, Jordan Rose <<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">Thoughts on the diff:</div></div></div></blockquote><div><br class=""></div><a href="https://github.com/atrick/swift/tree/unsafeptr_convert" class="">https://github.com/atrick/swift/tree/unsafeptr_convert</a></div><div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">- What was the thought behind putting UnsafeBytePointer in PointerTypeKind? OpaquePointer isn’t there, and I’m concerned about places that test if something’s a pointer by checking that the pointee type is non-null (by far the common pattern).</div></div></div></blockquote><div><br class=""></div><div>In general I wanted UnsafeBytePointer to stand-in for UnsafePointer<Void> throughout the type system and handle most of the same implicit conversions. Specifically, I wanted getAnyPointerElementType to do the same thing as UnsafePointer<Void> and return an empty tuple pointee type so that the calling code could be reused. Also, I thought that supporting PointerToPointerExpr was necessary.</div><div><br class=""></div><div>The only extra burden of doing this that I could find was that getPointerPointeePropertyDecl may return null. The only code that calls this is emitStoreToForeignErrorSlot.</div><div><br class=""></div><div>I'm very open to alternate implementations, especially once the proposal is accepted.</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">- The PrintAsObjC test can’t possibly pass as is—it’s checking that one pointer is const and the other isn’t. I’m guessing there’s actually more work to do here.</div></div></div></blockquote><br class=""></div><div><div><div>That's right. PrintAsObjC is one of several tests that are still failing. Before fixing them I want to:</div><div><br class=""></div><div>- get reassurance that we really want to replace the the imported type of 'void*'. Then I'll introduce an UnsafeMutableBytePointer.</div><div><br class=""></div><div>- determine precisely which implicit conversions we want to allow and update test cases accordingly.</div><div><br class=""></div><div>These are the tests that were failing on my branch (last time I succesfully rebased):</div><div><br class=""></div><div>POSIX.swift - requires String -> UnsafeBytePointer arg conversion</div><div>UnsafeBufferPointer.swift - UnsafePointer conversion rules?</div><div>UnsafePointer.swift - UnsafePointer conversion rules?</div><div>ClangModules/* - UnsafePointer conversion rules?</div><div>IRGen/objc_pointer - name mangling</div><div>SDK/c_pointers - [Double] to UnsafeBytePointer</div><div>SDK/objc_inner_pointer - [UInt8] to UnsafeBytePointer</div><div>Parse/pointer_conversion - 'UnsafePointer<Int>' to 'UnsafeBytePointer'</div><div>PrintAsObjC/classes.swift - void* export</div><div>SILGen/objc_currying - name mangling</div><div>SILGen/pointer_conversion - String to UnsafeBytePointer</div><div>SourceKit/DocSupport - formatting</div><div>sil-opt/emit-sib. - mangling</div><div>OpenCLSDKOverlay - [Float] to UnsafeBytePointer</div><div><br class=""></div></div><div class="">-Andy</div></div></body></html>