[swift-evolution] [swift-evolution-announce] [Review] SE-0125: Remove NonObjectiveCBase and isUniquelyReferenced
brent at architechies.com
Wed Jul 20 08:22:16 CDT 2016
> On Jul 20, 2016, at 5:59 AM, Arnold Schwaighofer <aschwaighofer at apple.com> wrote:
> The reason for this combination is data structures like Array which might hold an objc class which is not mutable. On a mutating operation you check is it uniquely reference and a swift class - if the answer is yes and you have enough storage you store to the current instance. (You can’t store to an NSArray for example, you would have to check it was a NSMutableArray, etc …)
It sounds to me like this is specifically tuned to the bridging the standard library happens to do, but you could very well want the opposite behavior in other cases. (For instance, `NSCountedSet` and `NSURLComponents` are both always-mutable; COW structs built around them would want to examine their refcounts.)
Is this the design we want to publish to users of the standard library? Or would it be better to have an `isNonObjectiveC(_:)` call and an `isUniquelyReferenced(_:)` call, and perhaps wrap them into one call for the standard library's internal use?
More information about the swift-evolution