<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 Jul 4, 2016, at 5:32 PM, Andrew Trick via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 28, 2016, at 11:05 PM, Chris Lattner <<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hello Swift community,<br class=""><br class="">The review of “SE-0107: UnsafeRawPointer API” begins now and runs through July 4, 2016. The proposal is available here:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md</a><br class=""></div></div></blockquote></div><div class=""><br class=""></div></div></div></blockquote><br class=""></div><div><div>I'm revising this proposal based on last week's feedback. A few of the</div><div>additive APIs are removed and a number of UnsafePointer and</div><div>UnsafeRawPointer methods are renamed.</div><div><br class=""></div><div>Here is a PR for the revision. Note that the examples in the proposal</div><div>text still need to be updated:</div><div><a href="https://github.com/apple/swift-evolution/pull/420" class="">https://github.com/apple/swift-evolution/pull/420</a></div><div><br class=""></div><div>I updated the short-form summary of the API:</div><div><a href="https://github.com/atrick/swift-evolution/blob/3122ace9d2fb55072ebd7395c7353fcbf497318a/proposals/0107-unsaferawpointer.md#full-unsaferawpointer-api" class="">https://github.com/atrick/swift-evolution/blob/3122ace9d2fb55072ebd7395c7353fcbf497318a/proposals/0107-unsaferawpointer.md#full-unsaferawpointer-api</a></div><div><br class=""></div><div>The full UnsafeRawPointer API with doc comments is here:</div><div><a href="https://github.com/atrick/swift/blob/22e3a2885e4236888ec447a7148acf633d8544f5/stdlib/public/core/UnsafeRawPointer.swift.gyb" class="">https://github.com/atrick/swift/blob/22e3a2885e4236888ec447a7148acf633d8544f5/stdlib/public/core/UnsafeRawPointer.swift.gyb</a></div><div><br class=""></div><div>The UnsafePointer and UnsafeRawPointer changes are on this branch:</div><div><a href="https://github.com/atrick/swift/commits/rawptr" class="">https://github.com/atrick/swift/commits/rawptr</a></div><div><br class=""></div><div>If you wish to comment line-by-line on the detailed docs or</div><div>implementation, you can do so here:</div><div><a href="https://github.com/apple/swift/pull/3437" class="">https://github.com/apple/swift/pull/3437</a></div><div><br class=""></div><div>--- </div><div>I should preemptively answer the question "why do UnsafeRawPointer</div><div>methods take an explicit type argument when it can be inferred?". Such</div><div>as:</div><div><br class=""></div><div> rawPtr.initializeMemory(as: Int.self, ...)</div><div><br class=""></div><div>These methods don't simply operate on values of some type, they</div><div>actively bind memory to that type. At the point of use, that type</div><div>needs to be explicit to convey that fact. It's important for</div><div>readability, comprehension, and correctness. We cannot rely on type</div><div>inferrence on some expression which can change without the original</div><div>author's intervention resulting in subtle miscompiles.</div><div><br class=""></div><div>---</div><div>The only concern I have about this version of the proposal is this method name: </div><div><br class=""></div><div> func copyBytes(from: UnsafeRawPointer, count: Int)</div><div><br class=""></div><div>because `count` usually refers to a number of values. I think it should be:</div><div><br class=""></div><div> func copy(bytes: Int, from: UnsafeRawPointer)</div><div class=""><br class=""></div><div class="">-Andy</div></div><br class=""></body></html>