When a method has return type
BOOL
, the value is converted to the integer
0
or
1
because Objective-C cannot distinguish this type from the other integer types. Often it is more convenient to receive the value as a Lisp boolean and this can be done by using the function invoke-bool, which returns
nil
or
t
.
For example, a call in Objective-C such as:
[box isSquare] ? 1 : 2
could be written using invoke-bool as:
(if (invoke-bool box "isSquare") 1 2)
LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 15 Dec 2011