On Mar 26, 2013, at 1:40 PM, Quincey Morris wrote:

>> If code expecting an NSOutlineView receives a TKOutlineView instance it may 
>> break or behave unexpectedly since it may well try to set a delegate 
>> conforming to <NSOutlineViewDelegate> but you have made your class require a 
>> delegate conforming to the more specific <TKOutlineViewDelegate>.
> 
> Chris's delegate actually implements NSOutlineViewDelegate, doesn't it?
> 
> Lee Ann's earlier suggestion of declaring TKOutlineViewDelegate to conform to 
> NSOutlineViewDelegate would prevent any remaining compiler complaints. Thus 
> the final declaration of the protocol would look like:
> 
>       @protocol TKOutlineViewDelegate <NSObject,NSOutlineViewDelegate>
> 
> Would that take care of your concern?


No. What Conrad is really suggesting is that there's a problem if the 
TKOutlineViewDelegate protocol has @required methods. For example, if you hand 
off the TKOutlineView to AppKit (for instance) and AppKit (for some reason) 
changes the delegate to some other NSOutlineViewDelegate-implementing object, 
it won't be implementing the required TKOutlineViewDelegate methods and will 
lead to an issue.

One answer to the problem is to never have required methods, but in practice I 
would think it's plenty safe to expect a delegate to not be swapped in the vast 
majority of cases. 


--
Seth Willits


_______________________________________________

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