Re: Extending NSMutableDictionary what am I doing wrong?
Re: Extending NSMutableDictionary what am I doing wrong?
- Subject: Re: Extending NSMutableDictionary what am I doing wrong?
- From: "b.bum" <email@hidden>
- Date: Thu, 26 Feb 2004 11:14:22 -0800
On Feb 26, 2004, at 5:30 AM, Ondra Cada wrote:
Meatime, consider whether a category would be sufficient for the
extension you need: if so, just use it. Categories work with class
clusters like a charm, and using them is *WAYS* easier than
subclassing anyway.
Sort of.
In this case, the developer wants....
- (NSString*)title;
- (NSData*)text;
.... and adding those two methods as a category on NSMutableDictionary
will result in every dictionary in the entire runtime responding to
those two methods. This will change the behavior of -valueForKey:.
If there is any UI element bound to 'text' or 'title' in any piece of
UI anywhere in the app -- regardless of whether it was originally a
part of the app or a plugin or a part of Cocoa -- those keys will no
longer be unbound.
Categories are very powerful and convenient. They are also dangerous.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.