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")