• 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: Can a subclass of NSDictionary do this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can a subclass of NSDictionary do this?


  • Subject: Re: Can a subclass of NSDictionary do this?
  • From: James Quick <email@hidden>
  • Date: Thu, 24 Jul 2003 16:04:28 -0400

On Wednesday, July 23, 2003, at 12:57 PM, Chris Hanson wrote:

On Wednesday, July 23, 2003, at 02:29 AM, p3consulting wrote:
NSKeyValueCoding is limited in functionality for general use

Not really, it's exceptionally useful for "general use." Just because it doesn't cover 100% of the features it would be nice to have doesn't mean it's useless. :)

(WebObject/EOFramework origin ?), for example in doesn't support array
in the path syntax
(e.g. "a.b[1].c")

This would be useful in some cases, though I haven't really felt a burning need for it in all the Cocoa development I've done. The scripting extensions to KVC would certainly support the addition of array access to the key-path parser.

and the takeValue:forKeyPath: doesn't create the
intermediary path items if they don't already exist
(ok this should be a parameter)

This would generally be a bad idea. How would KVC know (a) what types of intermediate path items to create and (b) how to go about creating them (i.e. what the designated initializer is etc.)?

Some may want something more general

It turns out, that for my use, additional functionality is required.
I've chosen a dual approach.

The actual get/store functionality will be performed by two methods added to
NSMutableDictionary via categories.

A new class, will define a stack of of NSDictionaries, and implement alternative
implementation of those two methods I added to NSMutableDictionary.
Thus I can write to the top dictionary on the stack, and lookup, by querying
in context dependant dictionaries first, falling back to more general defaults
upon failure.

This supports context specific customization, isolation, and the concept
of environmental scoping, with the least amount of work.
_______________________________________________
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.

References: 
 >Re: Can a subclass of NSDictionary do this? (From: Chris Hanson <email@hidden>)

  • Prev by Date: Re: pure virtual methods?
  • Next by Date: Re: pure virtual methods?
  • Previous by thread: Re: Can a subclass of NSDictionary do this?
  • Next by thread: Re: Can a subclass of NSDictionary do this?
  • Index(es):
    • Date
    • Thread