Contents (package MULK.OBJECTIVE-CL)
Define an exception to the rule that
BOOL as a method return type.
selector-designator --- a selector designator.
Normally, Objective-C treats method return values that are nominally of type
char as booleans and converts them to either t or nil depending on whether they are zerop. define-returns-boolean-exception directs Objective-CL to treat
char values returned by methods named by selector-designator as numbers instead.
undefine-returns-boolean-exception restores the default behaviour.
(define-returns-boolean-exception "charValue") (define-returns-boolean-exception "characterAtIndex:")
The Objective-C runtime offers no way of distinguishing booleans from chars, even though Foundation defines a
BOOL type. In the vast majority of cases,
char therefore actually means
BOOL, but the
NSString class, for one, wouldn't always agree with that sentiment, so the only sane way of handling both booleans and actual
char values is to determine the intentional type by method selector.