Re: cool way to call super?
Re: cool way to call super?
- Subject: Re: cool way to call super?
- From: Jonathan Dann <email@hidden>
- Date: Thu, 23 Sep 2010 17:28:36 +0200
On 23 Sep 2010, at 16:45, Matt Neuburg wrote:
> Is there a cool dynamic Cocoa way to call super with the same parameters
> that came to me? I guess what I'm looking for is a pre-configured invocation
> of the current command where I can just change the target to super. No big
> deal, but I just wondered, since Cocoa is cool and dynamic. m.
No, but you can easily write an NSProxy subclass that doesn't invoke the method, but returns you the runtime-generated NSInvocation by reference. i.e
NSInvocation *invocation;
[[object invocationProxy:&invocation] do:thing:with:any:number:of:args:you:want:];
Then get the objc_super struct using the invocation's target and its class and use libffi (http://sourceware.org/libffi/) to construct the argument list from the invocation and call objc_msgSendSuper() yourself.
Maybe.
I've not done the latter part, but I'm sure it would be possible. I feel a weekend project coming on.
Jonathan_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden