RespondsTo (Kernel)

RespondsTo(obj aSelector)

Checks to see if the object will respond to the specified selector (property or method). Call this before calling an object’s method or accessing an object’s property if you are unsure if the object actually contains it.

  • obj (heapPtr) – The object.
  • aSelector (selector) – The method or property selector.

TRUE if the object does respond to the selector, otherwise, FALSE.


(if (RespondsTo someObject #doit)
        (someObject doit:)
(if (RespondsTo someObject #text)
        (someObject text: "Hello world!")