On Thursday, June 14, 2007, at 08:28AM, "Christiaan Hofman" <[EMAIL PROTECTED]> wrote: >I am very much confused by the behavior of super. I thought it always >referred to the instance 'self' referring to the implementation of >its superclass to look up methods. So what happens if I re-assign >self, does it still refer to the current self with the superclass's >implementation of the current self? Or does it somehow stick with the >superclass of the original self?
That's an interesting problem. My read of the docs for objc_msgSendSuper is that the objc_super structure is generated at compile time when a super keyword is found. Since you're changing the immediate superclass at runtime, I think super would still point to the original superclass. >Let me give the concrete problem. In -[PDFAnnotation >initWithDictionary:], I did something like: > >... >self = [[SKPDFAnnotationNote alloc] initWithBounds:bounds]; >... >[(PDFAnnotationText *)super setIconType:iconType]; >... > >This gave me a run time error, saying that SKPDFAnnotationNote does >not implement -setIconType. Even though it inherits it from its >superclass (and moreover I call super, sot self, so why would it even >look in SKPDFAnnotation's implementation?) As to why the error says SKPDFAnnotationNote doesn't implement setIconType:, I don't know. It might be interesting to override -doesNotRecognizeSelector: in both classes and see what the call sequence is (or maybe just look at when the exception is raised). -- adam ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ skim-app-develop mailing list skim-app-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-develop