• 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: Initialising NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Initialising NSMutableArray


  • Subject: Re: Initialising NSMutableArray
  • From: Sherm Pendley <email@hidden>
  • Date: Mon, 13 Jul 2009 14:28:08 -0400

On Mon, Jul 13, 2009 at 12:53 PM, I. Savant<email@hidden> wrote:
> On Jul 13, 2009, at 12:41 PM, Quincey Morris wrote:
>
>> What you *don't* get for free from subclassing is an internal storage
>> mechanism -- you have to invent that for yourself (usually by putting a real
>> NSArray instance variable in your subclass :) ). You also need a pretty
>> clear understanding of how class clusters work, and that's where confusion
>> can set in.
>
>  These two sentences are exactly my point. Perhaps we have differing
> opinions of what makes an angry, fire-breathing, treasure-grubbing dragon.
> :-)

I agree with Quincey. The difficulty of subclassing a class cluster is
often over-stated on this list. There's really not much to it. Just
implement the primitive methods - by providing your own storage, or by
using a "real" collection object in an instance variable - and bob's
your uncle.

>  What's more (said in an off-list discussion with the OP): It's just not
> worth it to say "give me a mutable array with a single instance of a certain
> class".

Sure, if I wanted an easy way to get a single-element array of Foo,
I'd implement +arrayWithSingleFoo on the Foo class. I'd do it that way
even if NSArray were not a class cluster - there's no need to create a
whole new class just for such a simple task.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Initialising NSMutableArray (From: DKJ <email@hidden>)
 >Re: Initialising NSMutableArray (From: "I. Savant" <email@hidden>)
 >Re: Initialising NSMutableArray (From: Quincey Morris <email@hidden>)
 >Re: Initialising NSMutableArray (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: Crashes in Framework? Tracking down ghosts.
  • Next by Date: Re: Crashes in Framework? Tracking down ghosts.
  • Previous by thread: Re: Initialising NSMutableArray
  • Next by thread: Re: Initialising NSMutableArray
  • Index(es):
    • Date
    • Thread