Re: OBJ-C question
Re: OBJ-C question
- Subject: Re: OBJ-C question
- From: Ondra Cada <email@hidden>
- Date: Sat, 17 Apr 2004 20:26:53 +0200
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. I have never
tested it myself (!), but I guess they simply let you dry if you tried
things like loading the appropriate bundle AFTER setting the data
source/delegate:
>
> You couldn't simply call it in setDataSource: because the method
>
> could be added to the class after the data source object has been
>
> assigned.
In other words, this just won't work for a vast majority of delegates
and similar relationships (or so I think, no guarantee worldwide ;)
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.