Some Objective-C methods have arguments or values of type
, which is a pointer type used to represent selectors. These can be used in Lisp as foreign pointers of type sel, which can be obtained from a string by calling coerce-to-selector. The function selector-name can be used to find the name of a selector.
For example, a call in Objective-C such as:
could be written using can-invoke-p as in Determining whether a method exists or using selectors as follows:
(invoke foo "respondsToSelector:" (coerce-to-selector "frame"))
is bound to the result of calling
will return the string
LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 15 Dec 2011