Hello Swift Community,
The review of SE-0237 "Introduce Contiguous Collection Protocols" ran from November 16...27, 2018. The Core Team is returning this proposal for revision, with a few comments:
- The Core Team felt that the use of
inoutfor the closure parameter ofwithUnsafeMutableBufferPointer(IfSupported)was the best available option, and noted that the library could verify that theUnsafeMutableBufferPointeritself wasn't directly modified by checking for the expected base address / count after the call. This limits the chance of confusion without resorting to shadowing or excessive overloading ofmutatingoperations. - The two proposed protocols (
ContiguousCollectionandMutableContiguousCollection) aren't used in any algorithms within the library. It is not clear that they are important enough to introduce as protocols into the Standard Library at this time. The Core Team would like to consider a revised proposal that does not introduce these protocols. - There are use cases for a
Sequenceequivalent to the proposedwithUnsafeMutableBufferPointerIfSupported, such as initializing aStringfrom aSequenceofUTF-8code points that are (e.g.) stored in aData. The Core Team would like to see this addition to theSequenceprotocol, which would allowSequenceclients to optimize for the contiguously-stored case without requiring a new protocol, much as the proposal already allowsMutableCollectionclients to optimize for the contiguously-stored mutable case.
I'll initiate a new review thread for the revised proposal shortly.
Doug