Hi everyone. The review of SE-0467: MutableSpan begins now and runs through March 25, 2025.
Reviews are an important part of the Swift evolution process. All review feedback should be either on this forum thread or, if you would like to keep your feedback private, directly to the review manager via the forum messaging feature. When contacting the review manager directly, please keep the proposal link at the top of the message.
Trying it out
If you'd like to try this proposal out, you can download a toolchain supporting it:
The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
What is your evaluation of the proposal?
Is the problem being addressed significant enough to warrant a change to Swift?
Does this proposal fit well with the feel and direction of Swift?
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
A general collection is not contiguous, and therefore cannot vend a MutableSpan property over its contents. It would be feasible to provide either an optional mutable span (a la withContiguousMutableStorageIfAvailable),¹ or a closure-taking operation, but it likely makes sense to delay designing that to go with a more systematic proposal rethinking collections to account for ~Copyable/~Escapable constraints.
I'm still holding out hope that we formalize a ContiguousCollection protocol that guarantees this property--then it could provide span by default as well as mutableSpan when & MutableCollection.