On 2010 Mar 11, at 18:00, Gideon King wrote: > This is really cool...so I can replace a method without being a subclass or > category.
I just need to chime in here, in case anyone missed it, to emphasize how *ALL-CAPS COOL* this is indeed. In the ReadMe of Apple's MethodReplacement.zip sample code, it states "The trick is to define a category on the class whose method you want to replace." We have just learned that this sentence is incorrect. You do *not* need to define a category on the class whose method you want to replace. As Gideon showed in his code, the first argument of class_getInstanceMethod() need *not* be self, and therefore you can replace any method in *any* class, even a private one that's unknown to the SDK, with any other method in *any class*, even a different class. This makes Method Replacement much more powerful in debugging, and even patching bugs in Cocoa. I just sent Apple a "wasn't helpful" gram on that ReadMe. Thanks, Gideon. I hope you've found out who's sending that notification releasing your moc :) _______________________________________________ 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]
