On Jul 14, 2008, at 8:58 AM, Jeff Johnson wrote:
I can't imagine much use for method_exchangeImplementations() with my own classes, because I can write the implementations myself. You certainly need to be careful, but my example seemed pretty innocuous. Calling at the beginning of main() should avoid IMP caching issues, should it not?

You are changing the implementation of a class that you did not write. It violates implementation encapsulation and, thus, there is risk therein.

It is likely that this particular use is innocuous. But maybe not. The class could do something fun in +load or +initialize. Or the class could change in some future release to dynamically provide the method implementation. Or the class could insist upon only using its particular implementation of that particular method (security comes to mind).

The issue is that the behavior is not guaranteed.

Yes, this kind of breakage does happen...

As I said, I was just doing a proof of concept. I haven't shipped any apps with that code, though I know plenty of developers who have shipped much 'worse'. Even published API sometimes break, so development always involves the assessment of risk and reward, and as far as I know, Apple provides no official support for developers apart from paid DTS incidents.

... and every release of Mac OS X includes a huge amount of engineering effort ensuring that the published APIs do not break as documented by the bugs filed during the development cycle. Rarely is a published API broken in a final release vs. the previous release for applications compiled against that previous release (i.e. there may be documented behavioral changes -- should be documented -- if you recompile targeting the new release).

No such support exists or will exist for use of implementation details directly (i.e. unpublished methods).

b.bum

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to