• 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: Cocoa and messages to nil, revisited
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa and messages to nil, revisited


  • Subject: Re: Cocoa and messages to nil, revisited
  • From: Wade Tregaskis <email@hidden>
  • Date: Wed, 8 Aug 2007 22:48:14 -0700

The truly paranoid would do something like:

id cantbenull(id in)
{
	if (in == nil) @throw blah blah...
}

[cantbenull(this) uses:[(cantbenull(that) which:...

you get the picture. Clearly thats a ludicrous style, but I can guarantee
its *never* surprised by nil objects.

As I matter of opinion and personal style, I would argue that throwing an exception says exactly that you were surprised; if you were in any way anticipating a condition, you'd check for it and handle it, not just barf and goto up the stack somewhere.


Yes, maybe I've been bitten by some poor use of exceptions before... :)

Wade
_______________________________________________

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: 
 >RE: Cocoa and messages to nil, revisited (From: Jeff Laing <email@hidden>)

  • Prev by Date: Issues With JAWT_MacOSXDrawingSurfaceInfo
  • Next by Date: crash when accessing instance variables in class implementation
  • Previous by thread: Re: Cocoa and messages to nil, revisited
  • Next by thread: Re: Cocoa and messages to nil, revisited
  • Index(es):
    • Date
    • Thread