summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-03-18 14:21:43 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-03-18 14:21:43 +0100
commitbcb19b914dff33713a403e68c85a73faae4e9c3c (patch)
treeb01bf103841aed1a70de2715ebb4aa0e338b3519
parent8fc5914ad77601c0b444337bd95617ec5c9a9006 (diff)
Clarify CMUCL-specific function SELECTOR-FUNCTION.
darcs-hash:577b893aecdd9144a80184d973b1a6f970f4800a
-rw-r--r--Lisp/data-types.lisp26
1 files changed, 21 insertions, 5 deletions
diff --git a/Lisp/data-types.lisp b/Lisp/data-types.lisp
index 56cbbd8..67dcb70 100644
--- a/Lisp/data-types.lisp
+++ b/Lisp/data-types.lisp
@@ -143,11 +143,27 @@ The following calls are all equivalent:
#+cmu
(defun selector-function (selector)
- ;; FIXME? This is okay, as load-forms for selectors are defined
- ;; below. Unfortunately, having to call the compiler for each newly
- ;; interned selector makes COLLECT-SELECTORS slow.
- (compile nil `(lambda (receiver &rest args)
- (apply #'invoke-by-name receiver ,selector args))))
+ ;; FIXME? This is okay regardless of whether load-forms for selectors
+ ;; are defined, as those are only needed for the serialisation done by
+ ;; COMPILE-FILE, not for compilation per se. (CL semantics _are_
+ ;; defined on forms, not on source text, after all.) Unfortunately,
+ ;; having to invoke the compiler for each newly interned selector
+ ;; makes COLLECT-SELECTORS slow.
+ ;;
+ ;; (compile nil `(lambda (receiver &rest args)
+ ;; (apply #'invoke-by-name receiver ,selector args)))
+ ;;
+ ;; Faster, but yields interpreted functions:
+ ;;
+ ;; (coerce `(lambda (receiver &rest args)
+ ;; (apply #'invoke-by-name receiver ,selector args))
+ ;; 'function)
+ ;;
+ ;; Maybe compile the function upon the first call?
+ (let ((*compile-verbose* nil))
+ (let ((lambda-form `(lambda (receiver &rest args)
+ (apply #'invoke-by-name receiver ,selector args))))
+ (compile lambda-form nil))))
(defmethod initialize-instance :after ((selector selector)