• 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: nil messaging? Is it safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nil messaging? Is it safe?


  • Subject: Re: nil messaging? Is it safe?
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 27 Sep 2002 14:37:31 +0200

On Friday, September 27, 2002, at 04:48 , Jonathan Wight wrote:

If the original method fails
and returns null (and you've neglected to test for null) the subsequent
methods are not going to be executed. Instead of having to hunt this bug
down by hand, I'd love to be able to switch on a environment variable and
have all attempts to send messages to NULL logged.

Change your design. But for init, where it is part of the convention (and could be easily catched at the topmost level), don't use nil for the fail condition: the exceptions are what should be used in that case.

Returned nil is a *normal* condition meaning "none" or "empty answer".

There is just one situation which can't be easily cured this way, and that is an unassigned outlet. The IB helps somwehat by pointing out those; if you want to be completely sure, you can check for unassigned outlets programmatically eg. in awakeFromNib.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: nil messaging? Is it safe? (From: Jonathan Wight <email@hidden>)

  • Prev by Date: Help with window design
  • Next by Date: Window Title bar size?
  • Previous by thread: Re: nil messaging? Is it safe?
  • Next by thread: Re: nil messaging? Is it safe?
  • Index(es):
    • Date
    • Thread