On 19 Mar 2007, at 10:24, Michael Gardner wrote:
To use a custom key type with NSMutableDictionary, I defined -hash
and
-isEqual: but not -copyWithZone:, since the NSDictionary docs say
that
keys are retained rather than copied. But when I try to insert a key
of that type, I get an NSInvalidArgumentException saying that my
class
does not recognize -copyWithZone:. If I add that method, the
exception
goes away and everything works fine. I've tried this on both the
latest GNUstep release and on trunk. Are the docs just out-of-date?
Yes, the documentation is just wrong. Dictionary keys do need to be
copied.
I've fixed the documentation (at least, all the errors I spotted) in
svn
trunk to say that keys are copied.