Re: ^Block statement considered harmful for callbacks?
Re: ^Block statement considered harmful for callbacks?
- Subject: Re: ^Block statement considered harmful for callbacks?
- From: Lee Ann Rucker <email@hidden>
- Date: Thu, 25 Apr 2013 10:33:30 -0700 (PDT)
- Thread-topic: ^Block statement considered harmful for callbacks?
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" <email@hidden>
To: "Lee Ann Rucker" <email@hidden>
Cc: "Oleg Krupnov" <email@hidden>, "Cocoa-Dev List" <email@hidden>
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 (email@hidden)
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:
This email sent to email@hidden