On 29. Mrz 2006, at 10:35 Uhr, Richard Frith-Macdonald wrote:
The -objectForKey: and -setobject:forKey: methods exist in NSUserDefaults and NSDictionary with two different type signatures.

For NSDictionary the key is of type 'id' but for NSUserDefaults it is of type 'NSString*'

This can cause a lot of irritating compiler warnings when using these methods, so I was wondering if we should standardise on the 'id' type, and just have NSUserDefaults perform a runtime check (or even use [key description] to be sure that a key is a string). That would mean that the formally declared API for NSUserDefaults would differ slightly from the MacOS-X version, but it should not cause any problems that I can see.
What do people think?

IMHO you should stick to MacOSX API compatibility and require a cast, just like on OSX.

BTW: application level code should use KVC, not -objectForKey: (unless of course you do not work with string keys). This avoids the issue in most situations and is more generic in the same run.

Greets,
  Helge
--
http://docs.opengroupware.org/Members/helge/
OpenGroupware.org



_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to