• 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: Performing the selector from a stored IMP
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performing the selector from a stored IMP


  • Subject: Re: Performing the selector from a stored IMP
  • From: Matt Neuburg <email@hidden>
  • Date: Fri, 11 Feb 2011 13:06:29 -0800

On Feb 11, 2011, at 12:20 PM, Joanna Carter wrote:

>
>> Consider NSInvocation... m.
>
> Hmmm, nice!
>
> My only objection to using it in the circumstances I have is that it is a lot more code to setup

But consider NSUndoManager. What its +prepareWithInvocationTarget:+ does is almost exactly what you describe: you give it a target and send it a method call, a method call that NSUndoManager itself cannot respond to. Instead of complaining, it freeze-dries that method call and its parameters and the target into an NSInvocation and puts it on the Undo stack. (This is the only place where it differs from what you said; you said a "dictionary".) When you later say "undo" to the NSUndoManager, it pops that NSInvocation off the stack, un-freeze-dries it, and calls it. So NSUndoManager has a completely general way of freeze-drying *any* method call into an NSInvocation, on the spot! It isn't doing this by magic; it's using Objective-C's wonderful runtime. And so can you. m.

--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com


_______________________________________________

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

  • Follow-Ups:
    • Re: Performing the selector from a stored IMP
      • From: Joanna Carter <email@hidden>
References: 
 >Re: Performing the selector from a stored IMP (From: Matt Neuburg <email@hidden>)
 >Re: Performing the selector from a stored IMP (From: Joanna Carter <email@hidden>)

  • Prev by Date: Re: Performing the selector from a stored IMP
  • Next by Date: Re: Performing the selector from a stored IMP
  • Previous by thread: Re: Performing the selector from a stored IMP
  • Next by thread: Re: Performing the selector from a stored IMP
  • Index(es):
    • Date
    • Thread