Re: nil messaging? Is it safe?
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.