Skip navigation.
 
mlRe: NSNotificationCenter problem
FROM : Bill Bumgarner
DATE : Tue Nov 06 08:42:00 2007

On Nov 5, 2007, at 10:55 PM, Scott Stevenson wrote:
> On Nov 2, 2007, at 10:02 AM, Christiaan Hofman wrote:

>> I know. But it seems to me that if class posing is deprecated than 
>> method swizzling might also be "deprecated", perhaps even more so?

>
> Yes. Swizzling and all that hackery will not work in the future (64-
> bit, in particular) because the runtime is apparently moving away 
> from making everything revolve around raw structs.
>
> The idea is to resolve the fragile base class issue. Along with 
> better performance, better architecture, and so on.


You can still swizzle methods, you just can't do it in the raw Obj-C 
structures.  It is still considered naughty, but at least there is 
API via which you can commit the naughtiness in a somewhat predictable 
fashion (i.e. it'll do the right thing in terms of threading & cache 
flushing, but you'll still be hosed if you put the wrong IMP somewhere).

Specifically:

   OBJC_EXPORT BOOL class_addMethod(Class cls, SEL name, IMP imp, const 
char *types);
   OBJC_EXPORT IMP class_replaceMethod(Class cls, SEL name, IMP imp, 
const char *types);

And, yes, I don't like the "types" parameter any more than anyone 
else.  If you have suggestions as to how to make it more palatable, 
please file enhancement requests via (http://bugreporter.apple.com/).

b.bum

Related mailsAuthorDate
mlNSNotificationCenter problem Andreas Höschler Nov 1, 11:15
mlRe: NSNotificationCenter problem Christiaan Hofman Nov 1, 11:44
mlRe: NSNotificationCenter problem Scott Stevenson Nov 2, 02:28
mlRe: NSNotificationCenter problem Christiaan Hofman Nov 2, 10:59
mlRe: NSNotificationCenter problem Adam R. Maxwell Nov 2, 16:51
mlRe: NSNotificationCenter problem Christiaan Hofman Nov 2, 18:02
mlRe: NSNotificationCenter problem Adam R. Maxwell Nov 2, 18:28
mlRe: NSNotificationCenter problem Scott Stevenson Nov 6, 07:55
mlRe: NSNotificationCenter problem Bill Bumgarner Nov 6, 08:42
mlRe: NSNotificationCenter problem Bill Bumgarner Nov 6, 08:45
mlRe: NSNotificationCenter problem Scott Stevenson Nov 6, 10:58