summaryrefslogtreecommitdiff
path: root/Lisp/data-types.lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-03 09:12:03 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-03 09:12:03 +0100
commitafc1b0855e777332ff9331c70dad9d22b9d4ebfc (patch)
tree234958c12740a7673bc21995e2ab09cabb413d2e /Lisp/data-types.lisp
parent5c746b80b1daa4b5ab8b57346bda535ebca72b63 (diff)
Make selectors funcallable.
darcs-hash:cf005558542aa4148fe2e94a113c0eac682d3cac
Diffstat (limited to 'Lisp/data-types.lisp')
-rw-r--r--Lisp/data-types.lisp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lisp/data-types.lisp b/Lisp/data-types.lisp
index 0b5865d..ba98fc3 100644
--- a/Lisp/data-types.lisp
+++ b/Lisp/data-types.lisp
@@ -38,7 +38,8 @@
:initform (cffi:null-pointer))))
-(defclass selector (c-pointer-wrapper) ()
+(defclass selector (c2mop:funcallable-standard-object c-pointer-wrapper) ()
+ (:metaclass c2mop:funcallable-standard-class)
(:documentation "An Objective-C method selector.
## Description:
@@ -55,6 +56,18 @@ Use __find-selector__ instead.
__find-selector__"))
+(defmethod shared-initialize :after ((selector selector)
+ slot-names
+ &rest initargs
+ &key
+ &allow-other-keys)
+ (declare (ignore slot-names initargs))
+ (c2mop:set-funcallable-instance-function
+ selector
+ #'(lambda (receiver &rest args)
+ (apply #'invoke-by-name receiver selector args))))
+
+
(defclass id (c-pointer-wrapper) ()
(:documentation "An instance of an Objective-C class.