on Wed Jul 20 2016, Brent Royal-Gordon <brent-AT-architechies.com> wrote:
>> On Jul 19, 2016, at 11:06 PM, Dmitri Gribenko via swift-evolution >> <[email protected]> wrote: >> >> - I find it a little strange to see a mention of Objective-C, and a >> negation in `isUniquelyReferencedNonObjC`. For example, if we get C++ >> import, would we need to rename it to >> `isUniquelyReferencedNonObjCAndNonCXX`? I think that is the issue >> with negation. If we want to emphasize that the API will work only >> with Swift types, we can do something >> `isUniquelyReferencedSwiftReference`. But I would probably suggest >> that we just go with just `isUniquelyReferenced` and mention the >> Swift-only requirement in the documentation. > > I agree. > > What is the reason that isUniquelyReferenced(_:) doesn't work with > Objective-C? It doesn't seem like it'd be difficult to implement—you'd > either call -retainCount, or get it from the Objective-C runtime > somehow, and then test it against 1—so I assume there's a reason we > don't. There is; it's basically impossible to implement reliably given the state of Objective-C reference-counting. I'll let Greg Parker explain the details, as he has many times to me (but I don't retain them as well as he does). > I ask because knowing that may help us figure out how to name it. For > instance, if the issue is that we can't rely on Objective-C reference > counts, we might reverse the sense of the call and name it > `mayBeShared(_:)` or `mayHaveOtherReferences(_:)`. -- Dave _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
