I suspect the messaging-to-nil behavior is mostly confusing to intermediate programmers who only have experience with Java's passive-aggressive null references.
I suspect the messaging-to-nil behavior is mostly confusing to intermediate programmers who only have experience with Java's passive-aggressive null references.
NSArray *obj = nil;
[obj count]; // return 0
In theory a nil object can hide in your code for a long time if you only use methods that can return 0. NSAssert(array, @"Array can't be nil.");Personally I find that the nil behavior provides a useful base guideline for API design. When defining a method signature in Obj-C, you have to ask yourself if it's clear to the user of the method what happens when the method (inevitably) gets sent to nil. In that way, you have to think about the circumstances of the API's actual use, rather than just the ideal case.
[] brackets
{} braces
( opening parenthesis
) closing parenthesis
() parentheses
(( two opening parentheses
)) two closing parentheses
Way more info at http://en.wikipedia.org/wiki/BracketParenthesis, from "para" (next, beside, near) and "enthesis" (embedd, inline). So, essentialy to "inline near/next to something" (what we do with a parenthetical phrase).
If I had my way, I'd call them pointyparens.
And, by the way, the less pointy variant that is used in 'proper' typography is called a chevron or guillemet (http://en.wikipedia.org/wiki/Guillemet)