Re: isa
Re: isa
- Subject: Re: isa
- From: Aram Greenman <email@hidden>
- Date: Sat, 1 Jun 2002 18:02:51 -0700
On Saturday, June 1, 2002, at 05:20 PM, Ondra Cada wrote:
On Saturday, June 1, 2002, at 10:53 , Aram Greenman wrote:
You could avoid this by implementing a method like:
- (id)performSelector:(SEL)sel asClass:(Class)cls {
Class wasa = [self class];
id result;
isa = cls;
result = [self performSelector:sel];
isa = wasa;
return result;
}
possibly in a category of NSObject, along with
-performSelector:asClass:withObject:, etc.
I guess you just forgot NS_DURING...NS_HANDLER, did you not? ;))))
Just lazy. Submitted for your review:
- (id)performSelector:(SEL)sel asClass:(Class)cls {
Class wasa = [self class];
id result;
NS_DURING {
isa = cls;
result = [self performSelector:sel];
isa = wasa;
} NS_HANDLER {
isa = wasa;
[localException raise];
} NS_ENDHANDLER;
return result;
}
That's not meant to be offending, just to reming you that swizzling
*IS* dangerous, and you need to *VERY PRECISELY* know what you are
doing.
No offense taken,
Aram
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Re: isa (From: Ondra Cada <email@hidden>) |