Hi guys, after passing SE 184 (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
UnsafeMutableBufferPointer and UnsafeMutableRawBufferPointer.
You can read about the originally proposed API in the original SE 184
basically we use an at:from: system for binary memory state operations
where the at: argument supplies the start position in the destination
buffer, and the from: source argument supplies the number of elements to
copy/move into the destination.
newBuffer.moveInitialize(at: 0, from: self.buffer[self.zero... ])
newBuffer.moveInitialize(at: self.zero, from: self.buffer[0 ..< self.zero])
Some other proposed APIs include using subscript notation, and writing a
special buffer slice type and a corresponding protocol to handle this.
newBuffer[self.zero ... self.zero << 1].moveInitialize(from: self.buffer[0
A hypothetical comparison of this API, the at:from: API, and the existing
plain pointer API can be found in this basic Swift queue implementation here
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.