Contents (package MULK.OBJECTIVE-CL)


Function SELECTOR

Purpose:

Convert an object into a selector.

Syntax:

selector designator

Arguments and Values:

designator --- a selector designator.

Description:

selector-designator must be a valid selector designator, that is: either a selector object or one of a symbol, a string, or a list of symbols representing a selector.

If selector-designator is a string or a list of symbols, intern-selector is called and the value returned.

If selector-designator is a single symbol, it is treated as if it were a list whose car is the symbol and whose cdr is nil.

If selector-designator is a selector, it is simply returned.

Examples:

(selector "self")       ;=> #<SELECTOR `self'>  
(selector '(self))      ;=> #<SELECTOR `self'>  
(selector 'self)        ;=> #<SELECTOR `self'>  
(selector *)            ;=> #<SELECTOR `self'>  
  
(selector 'selph)       ; error  
  
(selector "stringWithCString:encoding:")  
  ;=> #<SELECTOR `stringWithCString:encoding:'>  
  
(selector '(:string-with-c-string :encoding))  
  ;=> #<SELECTOR `stringWithCString:encoding:'>  
  
#.(setq *readtable* (copy-readtable))  
#.(setf (readtable-case *readtable*) :invert)  
(selector '(:stringWithCString :encoding))  
  ;=> #<SELECTOR `stringWithCString:encoding:'>  
 

Note:

Setting the readtable case of the current readtable to :INVERT is a good way of making the Lisp system behave as traditionally as possible while making Objective-C method names case-sensitive.

On the other hand, writing all method names in lower case while separating parts by hyphens works nicely in all of the :INVERT, :UPCASE, :DOWNCASE, and :PRESERVE modes as well as Allegro CL's modern mode.

See also:

find-selector, intern-selector