• 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 18:34:09 +0100

On 7 Jun 2004, at 18:21, Marcel Weiher wrote:

On 7 Jun 2004, at 18:06, Nicko van Someren wrote:

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

That's a wrapper class. Not subclassing. Next.

That's a wrapper class for the references, to be used by the subclass of NSDictionary. It retains the pointer to the original object across to copying of the wrapper object.

Once you have the wrapper, you don't need a NSDictionary subclass,

True, but if you DO subclass then you can make it otherwise transparent to the user (e.g. not require the user to ever see the wrappers at all).

and you cannot (easily) do it with a subclass without the wrapper.

You can however, quite straightforwardly build something that as far as the user is concerned acts just exactly like an NSDictionary save for the copying of the key objects that are passed in. By subclassing NSDictionary you can (a) do it without having to re-implement the whole dictionary functionality and (b) be able to pass the new objects in wherever NSDictionary objects had been expected. Is this not the functionality that you were after?

I have implemented 2-3 of these wrapper classes myself.

I'll resist the temptation to suggest that you should have designed it better then, since if you'd done it right you would only have needed to implement one of these :-)

Next!

Sounds like a good plan.

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>
    • 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>)
 >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>)
 >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: Retain cycle problem with bindings & NSWindowController
  • 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