0.8.0.43:
authorChristophe Rhodes <csr21@cam.ac.uk>
Sat, 7 Jun 2003 13:49:11 +0000 (13:49 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Sat, 7 Jun 2003 13:49:11 +0000 (13:49 +0000)
Fix bug 63, by propagating symbol macros into the walker's
variable environment
... no, I don't claim to have understood the walker fully;
... test for correct behaviour in sb-cltl2's MACROEXPAND-ALL.

BUGS
NEWS
contrib/sb-cltl2/.cvsignore [new file with mode: 0644]
contrib/sb-cltl2/tests.lisp
src/pcl/walk.lisp
version.lisp-expr

diff --git a/BUGS b/BUGS
index 1d1a83d..910d617 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -257,17 +257,6 @@ WORKAROUND:
   then requesting a BACKTRACE at the debugger prompt gives no information
   about where in the user program the problem occurred.
 
-63:
-  Paul Werkowski wrote on cmucl-imp@cons.org 2000-11-15
-    I am looking into this problem that showed up on the cmucl-help
-    list. It seems to me that the "implementation specific environment
-    hacking functions" found in pcl/walker.lisp are completely messed
-    up. The good thing is that they appear to be barely used within
-    PCL and the munged environment object is passed to cmucl only
-    in calls to macroexpand-1, which is probably why this case fails.
-  SBCL uses essentially the same code, so if the environment hacking
-  is screwed up, it affects us too.
-
 64:
   Using the pretty-printer from the command prompt gives funny
   results, apparently because the pretty-printer doesn't know
diff --git a/NEWS b/NEWS
index 773ddf2..fb5f80e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1805,6 +1805,8 @@ changes in sbcl-0.8.1 relative to sbcl-0.8.0:
     SB-EXT:DEFCONSTANT-UNEQL if it is being asked to redefine a
     constant to a non-EQL value; CONTINUE and ABORT restarts
     respectively change and preserve the value.
+  * fixed bug 63: the code walker, part of the implementation of CLOS,
+    is better at handling symbol macros.
   * fixed some bugs revealed by Paul Dietz' test suite:
     ** NIL is now allowed as a structure slot name.
     ** arbitrary numbers, not just reals, are allowed in certain
diff --git a/contrib/sb-cltl2/.cvsignore b/contrib/sb-cltl2/.cvsignore
new file mode 100644 (file)
index 0000000..e805886
--- /dev/null
@@ -0,0 +1 @@
+test-passed
index c649297..19d5f05 100644 (file)
                           (foo 1))))))
       (remove-duplicates *expansions*))
   (1))
+
+(defun smv (env)
+  (multiple-value-bind (expansion macro-p) 
+      (macroexpand 'srlt env) 
+    (when macro-p (eval expansion))))
+(defmacro testr (&environment env) 
+  `',(getf (smv env) nil))
+
+(deftest macroexpand-all.4
+    (macroexpand-all '(symbol-macrolet ((srlt '(nil zool))) (testr)))
+  (symbol-macrolet ((srlt '(nil zool))) 'zool))
index e37c4f1..ac68857 100644 (file)
   (let ((lexenv (sb!kernel::coerce-to-lexenv env)))
     (sb!c::make-lexenv
      :default lexenv
+     :vars (when (eql (caar macros) *key-to-walker-environment*)
+            (copy-tree (remove :lexical-var (fourth (cadar macros))
+                               :key #'cadr)))
      :funs (append (mapcar (lambda (f)
                             (cons (car f)
                                   (sb!c::make-functional :lexenv lexenv)))
 (defun walker-environment-bind-1 (env &key (walk-function nil wfnp)
                                           (walk-form nil wfop)
                                           (declarations nil decp)
-                                          (lexical-variables nil lexp))
-  (let ((lock (environment-macro env *key-to-walker-environment*)))
+                                          (lexical-vars nil lexp))
+  (let ((lock (env-lock env)))
     (list
       (list *key-to-walker-environment*
-           (list (if wfnp walk-function     (car lock))
-                 (if wfop walk-form         (cadr lock))
-                 (if decp declarations      (caddr lock))
-                 (if lexp lexical-variables (cadddr lock)))))))
+           (list (if wfnp walk-function (car lock))
+                 (if wfop walk-form     (cadr lock))
+                 (if decp declarations  (caddr lock))
+                 (if lexp lexical-vars  (cadddr lock)))))))
 
 (defun env-walk-function (env)
   (car (env-lock env)))
 
 ;;; SBCL-only special forms
 (define-walker-template sb!ext:truly-the     (nil quote eval))
+;;; FIXME: maybe we don't need this one any more, given that
+;;; NAMED-LAMBDA now expands into (FUNCTION (NAMED-LAMBDA ...))?
 (define-walker-template named-lambda         walk-named-lambda)
 \f
 (defvar *walk-form-expand-macros-p* nil)
         (body (cddr form)))
     (walker-environment-bind
        (new-env old-env
-                :lexical-variables
+                :lexical-vars
                 (append (mapcar (lambda (binding)
                                   `(,(car binding)
                                     sb!sys:macro . ,(cadr binding)))
index 2cffca4..ba26d22 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.0.42"
+"0.8.0.43"