From 3d1e56e0ec4f2871cfa6f0307083fec0ef040062 Mon Sep 17 00:00:00 2001 From: jjgarcia Date: Tue, 9 Aug 2005 08:08:46 +0000 Subject: [PATCH] Evaluation of the constant in EQL specializers now takes place in the lexical environment in which DEFMETHOD is enclosed. --- src/CHANGELOG | 4 ++++ src/clos/method.lsp | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/CHANGELOG b/src/CHANGELOG index a91fc0f7f..bce2e5f1b 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -112,6 +112,10 @@ ECL 0.9g - Variable SI::*GC-VERBOSE* controls whether ECL emits messages when FASL libraries are garbage colleced. + - Values of EQL specializers are now evaluated in the lexical environment + in which the DEFMETHOD is enclosed. This makes it now possible to write + (defmethod foo (x) (defmethod bar ((f (eql x))))) + * ANSI compatibility: - Several functions that signaled type-errors did not set the right values diff --git a/src/clos/method.lsp b/src/clos/method.lsp index f47fa423f..7d68262c7 100644 --- a/src/clos/method.lsp +++ b/src/clos/method.lsp @@ -53,7 +53,7 @@ (INSTALL-METHOD ',name ',qualifiers - ',specializers + ,(list 'si::quasiquote specializers) ',specialized-lambda-list ',doc ',plist @@ -456,10 +456,15 @@ arg)) (push (if (listp arg) (first arg) arg) parameters) (push (if (listp arg) (first arg) arg) lambda-list) - (push (if (listp arg) (if (consp (second arg)) - `(eql ,(eval (cadadr arg))) - (second arg)) - ()) + (push (cond ((atom arg) '()) + ((atom (setf arg (second arg))) arg) + ((not (eql (first arg) 'EQL)) + (error 'simple-program-error + "Syntax error in method specializer ~A" arg)) + ((constantp (setf arg (second arg))) + `(eql ,arg)) + (t + (list 'eql (list 'si::unquote arg)))) specializers)) (when (eq (first arglist) '&OPTIONAL) (push (pop arglist) lambda-list)