Skip navigation.
 
mlRe: Delegates
FROM : Mike Abdullah
DATE : Mon May 19 23:16:19 2008

On 19 May 2008, at 21:23, I. Savant wrote:

> On Mon, May 19, 2008 at 2:54 PM, Michael Vannorsdel <<email_removed>
> > wrote:

>> There's nothing that guarantees a Cocoa delegate will act for 
>> another object
>> and that the represented object won't act how it wants as well. 
>> Sometimes a
>> delegate method is just a notification something happened/happening 
>> without
>> the delegate having any say on the matter or affect on the 
>> represented
>> object's course of action on that matter.

>
>  Yes, but the delegating object *always* follows this pattern:
>
> - I'm doing something for which I can ask a delegate for assistance or
> advice or in which the delegate might be interested, so ...
> - If I have a delegate ...
>  - If the delegate responds to this particular delegate message
>  - Send the message to the delegate and *wait for it to return* (ie,
> it's all within the same trip around the run loop, unlike
> notifications).


Um, that's wrong. To quote:

A notification center delivers notifications to observers 
synchronously. In other words, the postNotification:methods do not 
return until all observers have received and processed the 
notification. To send notifications asynchronously use 
NSNotificationQueue

Indeed, most -fooDidBar: style delegate methods are implemented via 
NSNotificationCenter. But of course that's just an implementation 
detail that probably doesn't matter to the OP.

Mike.

Related mailsAuthorDate
mlDelegates john darnell May 19, 18:22
mlRe: Delegates Michael Vannorsdel May 19, 18:52
mlRe: Delegates Nate Weaver May 19, 18:52
mlRe: Delegates I. Savant May 19, 18:58
mlRe: Delegates Michael Babin May 19, 18:59
mlRe: Delegates I. Savant May 19, 19:01
mlRe: Delegates Paul Sargent May 19, 19:30
mlRe: Delegates Nate Weaver May 19, 19:30
mlRe: Delegates Paul Sargent May 19, 19:35
mlRe: Delegates Michael Vannorsdel May 19, 19:37
mlRe: Delegates I. Savant May 19, 19:41
mlRe: Delegates I. Savant May 19, 19:41
mlRe: Delegates Michael Vannorsdel May 19, 20:00
mlRe: Delegates I. Savant May 19, 20:25
mlRe: Delegates I. Savant May 19, 20:31
mlRe: Delegates Andy Lee May 19, 20:52
mlRe: Delegates Michael Vannorsdel May 19, 20:54
mlRe: Delegates Jens Alfke May 19, 21:01
mlRe: Delegates Andy Lee May 19, 21:01
mlRe: Delegates Andy Lee May 19, 21:07
mlRe: Delegates I. Savant May 19, 22:23
mlRe: Delegates Michael Vannorsdel May 19, 22:42
mlRe: Delegates ben syverson May 19, 22:50
mlRE: Delegates john darnell May 19, 23:00
mlRe: Delegates Jeff LaMarche May 19, 23:04
mlRe: Delegates Mike Abdullah May 19, 23:16
mlRE: Delegates john darnell May 20, 15:58