• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!)


  • Subject: Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!)
  • From: Nicko van Someren <email@hidden>
  • Date: Mon, 7 Jun 2004 17:40:50 +0100

On 7 Jun 2004, at 17:11, Marcel Weiher wrote:

Nicko: one of the reasons that the current implementation is broken is that it *cannot* be fixed easily by subclassing!

That depends on what you call easy. It's trivial to do if you use a wrapper class like this (typed in Mail.app):

@interface RefWrapper : NSObject <NSCopying> {
id theRef;
}
- (id) initWithRef: (id) ref;
- (id) copyWithZone;
- (id) getRef;
@end
@implementation RefWrapper {
- (id) initWithRef: (id) ref { theRef = ref; return self; }
- (id) copyWithZone { return [[RefWrapper alloc] initWithRef: theRef]; }
- (id) getRef { return theRef; }
- (unsigned) hash { return [theRef hash]; }
- (BOOL) isEqual: (id) X { if [X isKindOfClass: [self class]] return [theRef isEqual: [X getRef]]; return NO; }
@end

Whereas the copying behavior *can* be added to a non-copying implementation via subclassing.

It seems to me, looking at the documentation, that there are only two extra messages that would have to be overridden to make the non-copying version from what we have using the above wrapper class (objectForKey: and keyEnumerator).

That was one of the original points I made.

It would really help if people would (a) read and (b) understand what was written before responding.

I did read and understand your previous postings, I just happen to disagree with them.

Nicko
_______________________________________________
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.


  • Follow-Ups:
    • Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!)
      • From: Marcel Weiher <email@hidden>
References: 
 >Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!) (From: Patrick Machielse <email@hidden>)
 >Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!) (From: Marco Scheurer <email@hidden>)
 >Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!) (From: Nicko van Someren <email@hidden>)
 >Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!) (From: Marcel Weiher <email@hidden>)

  • Prev by Date: Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!)
  • Next by Date: Re: Newbie Alert: NSMovieView with control won't update when movie changes.
  • Previous by thread: Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!)
  • Next by thread: Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!)
  • Index(es):
    • Date
    • Thread