<div dir="ltr"><div><div>Hi guys, after passing <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0184-unsafe-pointers-add-missing.md">SE 184 (A)</a>, I want to get some community feedback on the next phase of our Swift pointer overhaul which is a partial initialization/deinitialization API for <span style="font-family:monospace,monospace">UnsafeMutableBufferPointer</span> and <span style="font-family:monospace,monospace">UnsafeMutableRawBufferPointer</span>. <br><br></div>You can read about the originally proposed API in the <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0184-unsafe-pointers-add-missing.md">original SE 184 document</a>, basically we use an <span style="font-family:monospace,monospace">at:from:</span> system for binary memory state operations where the <span style="font-family:monospace,monospace">at:</span> argument supplies the start position in the destination buffer, and the <span style="font-family:monospace,monospace">from:</span> source argument supplies the number of elements to copy/move into the destination. <br></div><br><span style="font-family:monospace,monospace">newBuffer.moveInitialize(at: 0,         from: self.buffer[self.zero...   ])<br>newBuffer.moveInitialize(at: self.zero, from: self.buffer[0 ..&lt; self.zero])<br></span><div><br></div>Some other proposed APIs include using subscript notation, and writing a special buffer slice type and a corresponding protocol to handle this. <br><br><span style="font-family:monospace,monospace">newBuffer[0...                        ].moveInitialize(from: self.buffer[self.zero...   ])<br>newBuffer[self.zero ... self.zero &lt;&lt; 1].moveInitialize(from: self.buffer[0 ..&lt; self.zero])</span><br><br>A hypothetical comparison of this API, the <span style="font-family:monospace,monospace">at:from:</span> API, and the existing plain pointer API can be found in this basic Swift queue implementation <a href="https://gist.github.com/kelvin13/0860334278aeab5c1cbaefbefb050268">here</a> if anyone wants to see how this would look in “real” code. I’m interested in seeing which syntax and which API is preferred as well as what people would like to do with an expanded Swift buffer pointer toolbox.<br></div>