FROM : Mel Walker
DATE : Fri Dec 13 19:15:27 2002
On Friday, December 13, 2002, at 08:32 AM, matt neuburg
<<email_removed>> wrote:
> - (void)forwardInvocation:(NSInvocation *)invocation {
> if ([self->theString respondsToSelector:[invocation selector]])
> [invocation invokeWithTarget:self->theString];
> else
> [self doesNotRecognizeSelector:[invocation selector]];
> }
>
> - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {
> if ([theString respondsToSelector: aSelector])
> return [theString methodSignatureForSelector:aSelector];
> return [super methodSignatureForSelector:aSelector];
> }
>
> @end
>
> And here is some code to test it with:
> [...]
> // this fails, correctly - neither MyString nor NSString can
> respond
> NSRunAlertPanel(@"Test3", [s junk], nil, nil, nil);
> [s release];
Since I'm controlling the whole "inheritance" process here with
forwardInvocation: and methodSignatureForSelector:, is there a way I
can get bad selectors to fail silently? For example, in the [s junk]
call, can I just print out "bad selector:'junk'" and keep running with
the application?
Not that I have any reason at all for doing this in any application I'm
writing at the moment; it just seems like something cool I'd like to
know. :-)
--
Mel Walker <<email_removed>>
Software Engineer
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Fri Dec 13 19:15:27 2002
On Friday, December 13, 2002, at 08:32 AM, matt neuburg
<<email_removed>> wrote:
> - (void)forwardInvocation:(NSInvocation *)invocation {
> if ([self->theString respondsToSelector:[invocation selector]])
> [invocation invokeWithTarget:self->theString];
> else
> [self doesNotRecognizeSelector:[invocation selector]];
> }
>
> - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {
> if ([theString respondsToSelector: aSelector])
> return [theString methodSignatureForSelector:aSelector];
> return [super methodSignatureForSelector:aSelector];
> }
>
> @end
>
> And here is some code to test it with:
> [...]
> // this fails, correctly - neither MyString nor NSString can
> respond
> NSRunAlertPanel(@"Test3", [s junk], nil, nil, nil);
> [s release];
Since I'm controlling the whole "inheritance" process here with
forwardInvocation: and methodSignatureForSelector:, is there a way I
can get bad selectors to fail silently? For example, in the [s junk]
call, can I just print out "bad selector:'junk'" and keep running with
the application?
Not that I have any reason at all for doing this in any application I'm
writing at the moment; it just seems like something cool I'd like to
know. :-)
--
Mel Walker <<email_removed>>
Software Engineer
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| pascal | Dec 12, 05:43 | |
| Hasan Diwan | Dec 12, 06:16 | |
| Marco Binder | Dec 12, 16:27 | |
| pascal | Dec 13, 02:36 | |
| matt neuburg | Dec 13, 07:33 | |
| Mel Walker | Dec 13, 19:15 | |
| Mike Shields | Dec 13, 23:16 |






Cocoa mail archive

