Re: OBJ-C question
Re: OBJ-C question
- Subject: Re: OBJ-C question
- From: John Randolph <email@hidden>
- Date: Tue, 27 Apr 2004 16:02:34 -0700
On Apr 17, 2004, at 11:26 AM, Ondra Cada wrote:
On 17.4.2004, at 19:55, Kay Roepke wrote:
There's also efficiency to consider - without a default
implementation, you have to call respondsToSelector: before each call
to a data source method....
A pattern I've seen quite often in Apple's headers (I think it was in
Xcode class-dumps. Not too sure anymore where it was...) is
to have a struct in which the result of respondsToSelector: (i.e.
YES/NO) is saved.
Actually I believe the trick often is more subtle, namely that they
cache IMPs at setDelegate: (setDataSource:, etc) time.
No, that would be a lose, since it would defeat posing, forwarding,
etc. All we do typically is check and set a flag for whether the
delegate responds to the selectors in question.
-jcr
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.