Re: [Pyobjc-dev] NSUndoManager.prepareWithInvocationTarget_
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2002-12-30 21:06:43
|
On Monday, Dec 30, 2002, at 21:52 Europe/Amsterdam, bb...@ma... wrote: > On Monday, Dec 30, 2002, at 15:06 US/Eastern, Ronald Oussoren wrote: >> I expected that this would work, but it clearly doesn't. This seems >> to be caused by a misunderstanding on my part of the semantics of >> 'NSObject.respondsToSelector:'. I expected that this returns true >> whenever 'NSObject.methodSignatureForSelector:' returns a non-nil >> value, but it doesn't. > > This is frequently not the case in the context of forwarded > invocations and other proxy-like behavior. A class may return true to > respondsToSelector: but not actually provide a signature for the > selector. I sure hope that will never happen because if methodSignatureForSelector returns nil PyObjC cannot construct the correct NSInvocation. Note that NSUndoManager does return non-nil from methodSignatureForSelector but sometimes returns FALSE from respondsToSelector for methods that it actually responds to. With the patch I just checked in this is no longer a problem. > > NSUndoManager is just a big proxy that keeps invocations in a stack-- I noticed that, and I have to say that this a very neat way to implement an undo mechanism. Ronald |