nil and objective-j

Suppose I have an object instance called person, which has an instance method called yelp.

To call this method, in objective-j, I code:

[person yelp];

In most languages if person is null (or in this case nil) calling yelp would result in an exception being thrown.

Not in objective-j. The method* yelp isnt called.

Thats just wierd.

*Note that method calls are referred to as messages in objective-j.

Posted in Labels: , |

1 comments:

  1. Anonymous Says:

    This is an advantage though -- you don't need to block every access with a nil check or risk your app breaking. If you actually want to do something with nil, you can still check for it.