Re: Do IMPs move once they're loaded?
Re: Do IMPs move once they're loaded?
- Subject: Re: Do IMPs move once they're loaded?
- From: Brendan Younger <email@hidden>
- Date: Sat, 29 Jan 2005 22:08:57 -0600
On Jan 29, 2005, at 9:11 PM, mmalcolm crawford wrote:
On Jan 29, 2005, at 6:25 PM, Ken Tozier wrote:
Once it's in memory, yes. But the dilemma was how to store a selector
along with the data the selector operates on to disk when the
selector itself isn't a fixed length and Apple doesn't guarantee
identical hash values for the identical strings between OS releases.
At any rate, I got it working now. I wrote my own hashing function
(which I won't change between OS releases), store the selector
strings in an NSDictionary in the "initialize" method, and resolve
them as needed with NSSelectorFromString
Perhaps NSInvocation would be more appropriate?
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Classes/NSInvocation.html>
(Note that it conforms to NSCoding, and instances can be put in arrays
and dictionaries.)
Bad idea. NSInvocation only conforms to NSCoding to support
NSPortCoder; it shouldn't be archived.
As for the original poster's dilemma, there is no need to write your
own hash function; sheesh, just put the selector strings in an
NSDictionary and grab them later. Anyway, trying to get an optimized
special-case method called for a particular object is what subclasses
were invented for. Manually fooling around trying to determine which
type of object you're handling is terrible design.
Brendan Younger
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden