[swift-evolution] Remove isUniquelyReferenced or isUniquelyReferencedNonObjC?
Chris Eidhof
chris at eidhof.nl
Thu Dec 10 11:11:18 CST 2015
> On 10 Dec 2015, at 12:03, Joe Groff <jgroff at apple.com> wrote:
>
>
>> On Dec 10, 2015, at 9:00 AM, Chris Eidhof <chris at eidhof.nl> wrote:
>>
>> I think the name isUniquelyReferenced is better, and it should use the constraint to make sure it only works on Swift objects. That way there’s no confusion.
>
> I don't think the constraint is desirable. For most ObjC objects we just conservatively return 'false', but it isn't unreasonable to think that some ObjC types might be able to reliably answer isUniquelyReferenced in the future. Furthermore, IIRC the constraint works by requiring a `NonObjC` base class, and enforcing a common base class is not an acceptable design constraint for pure Swift code.
I didn’t realise that NonObjc was a class, I somehow thought it was a compiler-inserted protocol for Swift objects, haha.
So that’d mean you’d instead have the constraint in the documentation, saying that “this will currently not work on ObjC types”? Seems fair.
Chris
More information about the swift-evolution
mailing list