1.0.0.13: proper treatment of &whole and friends in ordinary lambda-lists
authorNikodemus Siivola <nikodemus@random-state.net>
Sun, 3 Dec 2006 12:02:52 +0000 (12:02 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sun, 3 Dec 2006 12:02:52 +0000 (12:02 +0000)
 * It is not clear the CLHS really prohibits them from being used as variables,
   but at least the error should not be a BUG. (reported by Berki Lukacs
   Tamas)

NEWS
src/compiler/parse-lambda-list.lisp
tests/compiler.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 107b7f4..e8d49a3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ changes in sbcl-1.0.1 relative to sbcl-1.0:
     SLOT-UNBOUND.  (reported by Pascal Costanza)
   * bug fix: an error was signaled at startup if the HOME environment 
     variable was defined, but had an empty value (reported by Peter Van Eynde)
+  * bug fix: non ordinary lambda-list keyword in ordinary lambda lists
+    signal a PROGRAM-ERROR, not a BUG.
   * optimization: loading generic functions no longer takes O(n^2) time,
     proportional to the amount of methods in the generic function
     (reported by Todd Sabin and Jeremy Brown)        
index d98953b..5569eb3 100644 (file)
                  (compiler-error "multiple &AUX in lambda list: ~S" list))
                (setq auxp t
                      state :aux))
-              (t (bug "unknown LAMBDA-LIST-KEYWORD in lambda list: ~S." arg)))
+              (t 
+               ;; It could be argued that &WHOLE and friends would be just ordinary
+               ;; variables in an ordinary lambda-list, but since (1) it seem exceedingly
+               ;; unlikely that that was that the programmer actually ment (2) the spec 
+               ;; can be interpreted as giving as licence to signal an error[*] we do.
+               ;;
+               ;; [* All lambda list keywords used in the
+               ;; implementation appear in LAMBDA-LIST-KEYWORDS. Each
+               ;; member of a lambda list is either a parameter
+               ;; specifier ot a lambda list keyword. Ergo, symbols
+               ;; appearing in LAMBDA-LIST-KEYWORDS cannot be
+               ;; parameter specifiers.]
+               (compiler-error 'simple-program-error
+                               :format-control "Bad lambda list keyword ~S in: ~S"
+                               :format-arguments (list arg list))))
             (progn
               (when (symbolp arg)
                 (let ((name (symbol-name arg)))
 ;;; even if they could conceivably be legal in not-quite-a-lambda-list
 ;;; weirdosities
 (defun parse-lambda-list (lambda-list)
-
   ;; Classify parameters without checking their validity individually.
   (multiple-value-bind (required optional restp rest keyp keys allowp auxp aux
                         morep more-context more-count)
       (parse-lambda-list-like-thing lambda-list)
-
+    
     ;; Check validity of parameters.
     (flet ((need-symbol (x why)
              (unless (symbolp x)
index 7d9a58f..a3d6f33 100644 (file)
   ((and (not style-warning) warning) (e)
     (error e)))
 
+;;; program-error from bad lambda-list keyword
+(assert (eq :ok
+            (handler-case 
+                (funcall (lambda (&whole x)
+                           (list &whole x)))
+              (program-error ()
+                :ok))))
+(assert (eq :ok
+            (handler-case
+                (let ((*evaluator-mode* :interpret))
+                  (funcall (eval '(lambda (&whole x)
+                                   (list &whole x)))))
+              (program-error ()
+                :ok))))
+
 ;;; success
index d70f6ba..ffb4122 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".)
-"1.0.0.12"
+"1.0.0.13"