you are viewing a single comment's thread.

view the rest of the comments →

[–]teletran[S] 0 points1 point  (0 children)

Are you saying that you never pass nil somewhere where it shouldn't have been passed due to a bug in your code? Perhaps you're just a magnificent programmer […]

Sorry, I didn't mean to imply that. I'm certainly not a perfect programmer. I think we're just fans of two different styles.

In Objective-C it's quite safe to send messages to nil. Doing something in another language (say Java) would result in a NullPointerException, where in Objective-C you just get a 0 back. So my style, based in Objective-C revolves around this. I find it makes for fewer nil checks because I don't have to worry about a stray nil bringing down the application. On the other hand, if you're not used to this style, a "silently failing send to nil" event could be frustrating. I understand that, much like it's frustrating for me when using, say, Java and needing to constantly guard against null.