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

Re: class variables


  • Subject: Re: class variables
  • From: Colin Howarth <email@hidden>
  • Date: Wed, 7 Oct 2009 02:08:28 +0200

On 7 Oct, 2009, at 01:53, Bill Bumgarner wrote:
On Oct 6, 2009, at 4:48 PM, Colin Howarth wrote:
I'm coming across the odd instance where the use of a class variable would seem to make sense.

I can do this with a static definition in the class implementation file, I suppose.

Question is: is this particularly frowned upon in the Cocoa world? If so, why?

Static variables within the scope of the file are the way to go. It isn't particularly frowned upon, but initialization can sometimes be tricky.

OK. Thanks Bill (and Luke).

As well, global variables are generally an impediment to subsequent refactoring;

Not likely to be a problem in the present case.

what if you want two distinct and isolated subsystems that would then need their own distinct versions of the globals, for example?

You'd have to do a global search and replace, I suppose? :-)



_______________________________________________

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: 
 >class variables (From: Colin Howarth <email@hidden>)
 >Re: class variables (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: class variables
  • Next by Date: Problem using filewrappers under snow leopard
  • Previous by thread: Re: class variables
  • Next by thread: Problem using filewrappers under snow leopard
  • Index(es):
    • Date
    • Thread