Re: [swift-users] Checking whether an object is uniquely referenced, using a weak reference to it

2016-09-18 Thread Dave Abrahams via swift-users
on Tue Jun 28 2016, Jordan Rose wrote: >> On Jun 27, 2016, at 18:52, Tim Vermeulen wrote: >> >> Thanks for your reply. It didn’t clear up everything, though. The >> official documentation says "Weak references do not affect the >> result of this function.”, which suggests

Re: [swift-users] Checking whether an object is uniquely referenced, using a weak reference to it

2016-06-28 Thread Joe Groff via swift-users
> On Jun 28, 2016, at 9:32 AM, Jordan Rose via swift-users > wrote: > > >> On Jun 27, 2016, at 18:52, Tim Vermeulen wrote: >> >> Thanks for your reply. It didn’t clear up everything, though. The official >> documentation says "Weak references do

Re: [swift-users] Checking whether an object is uniquely referenced, using a weak reference to it

2016-06-27 Thread Tim Vermeulen via swift-users
Thanks for your reply. It didn’t clear up everything, though. The official documentation says "Weak references do not affect the result of this function.”, which suggests that weak (and unowned) references intentionally aren’t counted. The docs only mention the implementation of copy-on-write

Re: [swift-users] Checking whether an object is uniquely referenced, using a weak reference to it

2016-06-27 Thread Jordan Rose via swift-users
Hi, Tim. The purpose of the isUniquelyReferenced checks is to see whether any changes to the properties of the object can be observed from elsewhere in this program. Therefore, I would expect it to return ‘false’ when there are weak (or unowned) references present, i.e. I think the bug is that

[swift-users] Checking whether an object is uniquely referenced, using a weak reference to it

2016-06-27 Thread Tim Vermeulen via swift-users
class EmptyClass {} var strongReference = EmptyClass() weak var weakReference = strongReference print(isUniquelyReferencedNonObjC()) // true print(isUniquelyReferencedNonObjC()) // false I expected both print statements to print true. I realise that this is probably a known limitation of