Re: Objects as keys NSMutableDictionary
Re: Objects as keys NSMutableDictionary
- Subject: Re: Objects as keys NSMutableDictionary
- From: Rosyna <email@hidden>
- Date: Mon, 10 Jul 2006 07:19:26 -0700
Well, if it assumed the keys were always strings, then it would just
use kCFCopyStringDictionaryKeyCallBacks when creating the internal
CFDictionary. In which case this would make the copyWithZone: a
useless extra step. It's also why I mistakenly assumed that creating
the NSDictionary with the CF call using different callbacks would
address this issue.
Well, at least the documentation for setObject:forKey: explicitly
says that the key must respond to copyWithZone:. In these cases, it
might just be best to return [self retain] or something.
Ack, at 7/10/06, Adam R. Maxwell said:
On Jul 10, 2006, at 06:43, Rosyna wrote:
As, I see. NSCFDictionary explicitly calls copyWithZone: before
setting the key using CFDictionarySetValue(). I wonder why.
Yes, and that wasn't expected behavior in my case; perhaps it does
this because Keys Are Always NSStrings? My bug report disappeared
into the black hole of "Duplicate" so I'll never know, but I'm glad
Mike Ash pointed this out a few weeks ago.
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
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