> On Jul 20, 2016, at 5:59 AM, Arnold Schwaighofer <[email protected]> 
> 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?

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to