<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 Sep 3, 2017, at 8:38 PM, Taylor Swift <<a href="mailto:kelvin13ma@gmail.com" class="">kelvin13ma@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""></div><div class="">what was the reasoning for making raw at: offset in strides and not bytes?</div></div></div></blockquote><div><br class=""></div>So, you’re talking about UnsafeMutableRawPointer(as:at:count:to:)…</div><div><br class=""></div><div>The thinking was that it was typical for users to continue filling in the memory using the same type, and that manually performing address arithmetic is error prone.</div><div><br class=""></div><div>Now that we're considering consistency with the raw buffer pointer API, which didn’t exist at the time, the thinking is that `at` can be ambiguous and that manual address arithmetic is actually less error prone and increases clarity at the call site.</div><div><br class=""></div><div>Does that adequately sum of the last few messages in this thread?</div><div><br class=""></div><div>-Andy</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class="">On Sep 3, 2017, at 10:22 PM, Andrew Trick <<a href="mailto:atrick@apple.com" class="">atrick@apple.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Sep 3, 2017, at 8:05 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">If we use byte offset, then the<span class="Apple-converted-space"> </span><span style="font-family: monospace, monospace;" class="">at</span><span class="Apple-converted-space"> </span>parameter in<span class="Apple-converted-space"> </span><span style="font-family: monospace, monospace;" class="">UnsafeMutableRawPointer</span><span class="Apple-converted-space"> </span>should be removed, since pointer arithmetic can be used instead (just like with<span class="Apple-converted-space"> </span><span style="font-family: monospace, monospace;" class="">UnsafeMutablePointer</span>).</div></div></div></div></blockquote><div dir="auto" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div dir="auto" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I agree that it seems quite sensible to remove the ‘at’ parameter altogether from the UMRP method.</div></div></blockquote><div class=""><br class=""></div>No code in tree or on github is using the `at` argument. I think it can be removed. A fixit should still be possible.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><blockquote class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Not convinced moving the<span class="Apple-converted-space"> </span><span style="font-family: monospace, monospace;" class="">at:</span><span class="Apple-converted-space"> </span>argument to come before the<span class="Apple-converted-space"> </span><span style="font-family: monospace, monospace;" class="">as:</span><span class="Apple-converted-space"> </span>argument is worth it in terms of source breakage.</div></div></div></div></blockquote><div dir="auto" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div dir="auto" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Since much of this proposal involves shuffling and relabeling arguments, I’d argue it’s better to break slight more source in one go for the optimal API than to break slightly less for a slightly less optimal API, no? (This is assuming there is agreement that ‘at:as:’ is less prone to misinterpretation than ‘as:at:’.)</div></div></blockquote></div><div class=""><br class=""></div><div class="">To be clear, we’re just talking about UnsafeMutableRawBufferPointer.initializeMemory now, so this is purely additive.</div><div class="">I think the label needs to be `atByteOffset`, and placing it before `as` makes a lot of sense because it no longer depends on the type’s stride. </div><div class=""><br class=""></div><div class="">-Andy</div></div></blockquote></div></div></blockquote></div><br class=""></body></html>