• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: cool way to call super?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >cool way to call super? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: cool way to call super?
  • Next by Date: NSTextView/Field to relinquish firstResponder after return key
  • Previous by thread: Re: cool way to call super?
  • Next by thread: Cocoa Text System - Temporarily Disabling Layout
  • Index(es):
    • Date
    • Thread