Version 2 (modified by rme, 10 years ago) (diff)


Cocoa Bridge Tips


In Objective-C, nil is a null pointer. In Lisp, nil is...well, let's not get into it. Don't mix these up. Use +null-ptr+ in Lisp where you would write nil in Objective-C.

For example, you would write

(#/arrayWithObjects: ns:ns-array #@"foo" #@"bar" #@"baz"
                     +null-ptr+) ;don't even think about putting nil here

Memory Management

The  normal Cocoa memory managment rules apply to instances of Objective-C objects created from Lisp. The Lisp doesn't automatically release them.

Class methods

A class method such as

@implementation FooPanel
+ sharedFooPanel

is defined like this:

(objc:defmethod #/sharedFooPanel ((self +foo-panel))