<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 19, 2017 at 9:31 PM, Andrew Trick <span dir="ltr">&lt;<a href="mailto:atrick@apple.com" target="_blank">atrick@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><br><div><span class="gmail-"><blockquote type="cite"><div>On Aug 19, 2017, at 6:16 PM, Taylor Swift &lt;<a href="mailto:kelvin13ma@gmail.com" target="_blank">kelvin13ma@gmail.com</a>&gt; wrote:</div><br class="gmail-m_321540164580745063Apple-interchange-newline"><div><div dir="ltr">What you’re describing is basically an earlier version of the proposal which had a slightly weaker precondition (source &gt;= destination) than yours (source == destination). That one basically ignored the Sequence methods at the expense of greater API surface area.<br></div></div></blockquote><div><br></div></span><div>The Sequence methods don’t provide the simpler, more convenient form of initialization/<wbr>deinitialization that I thought you wanted. I see two reasonable options.</div><div><br></div><div>1. Don’t provide any new buffer initialization/<wbr>deinitialization convenience. i.e. drop UsafeMutableBufferPointer moveInitialize, moveAssign, and deinitialize from your proposal.</div><div><br></div><div>2. Provide the full set of convenience methods: initialize, assign, moveInitialize, and moveAssign assuming self.count==source.count. And provide deinitialize() to be used only in conjunction with those new initializers.</div><div><br></div><div>The question is really whether those new methods are going to significantly simplify your code. If not, #1 is the conservative choice. Don&#39;t provide convenience which could be misused. Put off solving that problem until we can design a new move-only buffer type that tracks partially initialized state.</div><div><br></div><div>-Andy <br></div></div><br></div></blockquote></div></div><br>I’m not sure the answer is to just omit methods from <span style="font-family:monospace,monospace">UnsafeMutableBufferPointer</span> since most of the original complaints circulated around having to un-nil <span style="font-family:monospace,monospace">baseAddress</span> to do anything with them.<br><br>What if only unary methods should be added to <span style="font-family:monospace,monospace">UnsafeMutableBufferPointer</span> without <span style="font-family:monospace,monospace">count:</span>, meaning:<div class="gmail_extra"><br></div><div class="gmail_extra"><span style="font-family:monospace,monospace">initialize(repeating:)</span></div><div class="gmail_extra"><span style="font-family:monospace,monospace">assign(repeating:)</span></div><div class="gmail_extra"><span style="font-family:monospace,monospace">deinitialize()</span></div><div class="gmail_extra"><br></div><div class="gmail_extra">and the other methods should take both an <i>offset</i> parameter instead of a count parameter:</div><div class="gmail_extra"><span style="font-family:monospace,monospace"><br></span></div><div class="gmail_extra"><span style="font-family:monospace,monospace">initialize(from:at:)</span></div><div class="gmail_extra"><span style="font-family:monospace,monospace">assign(from:at:)</span></div><div class="gmail_extra"><span style="font-family:monospace,monospace">moveInitialize(from:at:)</span></div><div class="gmail_extra"><span style="font-family:monospace,monospace">moveAssign(from:at:)</span></div><div class="gmail_extra"><br></div><div class="gmail_extra">which provides maximum explicitness. This requires improvements to buffer pointer slicing though. But I’m not a fan of the mission creep that’s working into this proposal (i only originally wrote the thing to get <span style="font-family:monospace,monospace">allocate(capacity:)</span> and <span style="font-family:monospace,monospace">deallocate()</span> into <span style="font-family:monospace,monospace">UnsafeMutableBufferPointer</span>!)<br></div><div class="gmail_extra"><br></div></div>