Figured there must be something like that :) We have complicated reasons for 
doing it with classes (C++ is involved) and since I'm at home hitting reload on 
the WWDC ticket site I don't have the docs available. 

----- Original Message -----
From: "Torsten Curdt" <tcu...@vafer.org>
To: "Lee Ann Rucker" <lruc...@vmware.com>
Cc: "Oleg Krupnov" <oleg.krup...@gmail.com>, "Cocoa-Dev List" 
<cocoa-dev@lists.apple.com>
Sent: Thursday, April 25, 2013 10:27:14 AM
Subject: Re: ^Block statement considered harmful for callbacks?

> MyWeakRef *weakRef = [MyWeakRef weakRefFromObject:self];
>
> ^() = {
>   Foo *wself = [weakRef originalObject];
>   // wself may be nil, that's cool because we only want to doStuff if 'self' 
> is still around.
>   [wself doStuff];
> }

How is that different from

  __typeof__(self) __weak wself = self;
  ^() = {
    [wself doStuff];
  }

...or am I missing something from the beginning of the thread?

cheers,
Torsten
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to