The review for SE-0517: UniqueBox has concluded and the proposal has been accepted.
The review brought up several key areas of feedback that the language steering group considered:
- Reviewers observed that this feature partly duplicated the current built-in feature of
indirectthat can be used on enums. The LSG discussed this, and concluded that a concrete type, on which integrated language support could be layered (similar toOptional) is the right approach in this case. (a similar thought process applies to the current review ofBorrowthe type, as distinct from support for borrowed bindings). - Some reviewers would have liked to extend this type to allow it to take ownership of given to it (i.e. take an unsafe pointer and some support for configuring how to free it). The LSG believes this is beyond the scope of this type, that is aimed at allowing for guaranteed safe indirect storage of a value as an important building block in the standard library, not a general-purpose smart pointer-like type.
- Relatedly, the LSG thinks that "Box" is the right name, rather than "Pointer", as this is not a "safe replacement for
UnsafePointer". Box/boxing is generally accepted as a term of art for what this type is, including in other languages. - The adoption of a
Uniqueprefix for a noncopyable variant (with unprefixedBoxrepresenting some possible future copy-on-write-supporting version) is a pattern that the team thinks is appropriate to be adopted more widely (including with the currently-in-reviewUniqueArray) - Some concerns were raised about the soundness of the current model for exclusive access in the presence of tasks and actors. The LSG acknowledges this issue but believes this to be a general issue with Swift that should be looked at, but can be tackled separately and needn't affect the review for this specific type.
Thank you to everyone who participated in the review.