Contents (package MULK.OBJECTIVE-CL)

Funcallable Standard Class SELECTOR


An Objective-C method selector.

Inherits From:

funcallable-standard-object, c-pointer-wrapper (internal)


Method selectors are Objective-C's equivalent to what Common Lisp calls symbols. Their use, however, is restricted to retrieving methods by name.

In Common Lisp, you can funcall a selector directly (see the note below for details and why you may want to do this).

selector objects cannot be created by means of make-instance. Use find-selector instead.


Instead of using invoke, which is neither macro-friendly nor very useful for method selection at run-time, you may funcall selectors directly. Naturally, apply works as well.

The following calls are all equivalent:

(invoke-by-name instance "stringWithCString:encoding:" "Mulk." 4)  
(invoke instance :string-with-c-string "Mulk." :encoding 4)  
(funcall (selector "stringWithCString:encoding:") instance "Mulk." 4)  
(apply (selector "stringWithCString:encoding:") (list instance "Mulk." 4))  

See also: