From bcb19b914dff33713a403e68c85a73faae4e9c3c Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Tue, 18 Mar 2008 14:21:43 +0100 Subject: Clarify CMUCL-specific function SELECTOR-FUNCTION. darcs-hash:577b893aecdd9144a80184d973b1a6f970f4800a --- Lisp/data-types.lisp | 26 +++++++++++++++++++++----- 1 file 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) -- cgit v1.2.3