1.3.8 Determining whether a method exists

In some cases, an Objective-C class might have a method that is optionally implemented and invoke will signal an error if the method is missing for a particular object. To determine whether a method is implemented, call the function can-invoke-p with the foreign object pointer or class name and the name of the method.

For example, a call in Objective-C such as:

[foo respondsToSelector:@selector(frame)]

could be written using can-invoke-p as:

(can-invoke-p foo "frame")
LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 29 Feb 2008