• 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: checking if an object's instance exists.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checking if an object's instance exists.


  • Subject: Re: checking if an object's instance exists.
  • From: daniel <email@hidden>
  • Date: Sat, 5 Feb 2005 12:01:44 -0800

I think it's just more work.  And work should be avoided at all costs :)

It took me a while to get comfortable with the "everything is inited to nil, and nil is safe to message" mindset that goes with Cocoa, but it's in there firm now and I don't deny it. I don't manually initialize ivars to nil anymore than I check for nil before messaging an object. Just do it.

Another comparison would be IBOutlet connections. This is something that is done for you contractually by the environment you're working in. It might add clarity to add code to your awakeFromNib method to manually go through and reconnect them all, but it would be a waste of effort.

Daniel

On Feb 5, 2005, at 10:08 AM, Kevin Ballard wrote:

On the other hand, it's still nice to initialize ivars to null (or whatever you want their default values to be) in the initializer for clarity's sake.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: checking if an object's instance exists.
      • From: Kevin Ballard <email@hidden>
References: 
 >checking if an object's instance exists. (From: Aaron Boothello <email@hidden>)
 >Re: checking if an object's instance exists. (From: Kevin Ballard <email@hidden>)
 >Re: checking if an object's instance exists. (From: Sherm Pendley <email@hidden>)
 >Re: checking if an object's instance exists. (From: Kevin Ballard <email@hidden>)

  • Prev by Date: How do you use the space key as a key equivalent
  • Next by Date: Re: How do you use the space key as a key equivalent
  • Previous by thread: Re: checking if an object's instance exists.
  • Next by thread: Re: checking if an object's instance exists.
  • Index(es):
    • Date
    • Thread