0.8alpha.0.8:
[sbcl.git] / src / code / macros.lisp
index b4453d1..51214a4 100644 (file)
   (let ((keyform-value (gensym))
        (clauses ())
        (keys ()))
-    (dolist (case cases)
+    (do* ((cases cases (cdr cases))
+         (case (car cases) (car cases)))
+        ((null cases) nil)
       (unless (list-of-length-at-least-p case 1)
        (error "~S -- bad clause in ~S" case name))
       (destructuring-bind (keyoid &rest forms) case
-       (cond ((memq keyoid '(t otherwise))
+       (cond ((and (memq keyoid '(t otherwise))
+                   (null (cdr cases)))
               (if errorp
                   (progn
-                    ;; FIXME: this message could probably do with
-                    ;; some loving pretty-printer format controls.
-                    (style-warn "Treating bare ~A in ~A as introducing a normal-clause, not an otherwise-clause" keyoid name)
+                    (style-warn "~@<Treating bare ~A in ~A as introducing a ~
+                                  normal-clause, not an otherwise-clause~@:>"
+                                keyoid name)
                     (push keyoid keys)
                     (push `((,test ,keyform-value ',keyoid) nil ,@forms)
                           clauses))
   #!+sb-doc
   "Evaluate FORM and return the Nth value (zero based). This involves no
   consing when N is a trivial constant integer."
+  ;; FIXME: The above is true, if slightly misleading.  The
+  ;; MULTIPLE-VALUE-BIND idiom [ as opposed to MULTIPLE-VALUE-CALL
+  ;; (LAMBDA (&REST VALUES) (NTH N VALUES)) ] does indeed not cons at
+  ;; runtime.  However, for large N (say N = 200), COMPILE on such a
+  ;; form will take longer than can be described as adequate, as the
+  ;; optional dispatch mechanism for the M-V-B gets increasingly
+  ;; hairy.
   (if (integerp n)
       (let ((dummy-list nil)
            (keeper (gensym "KEEPER-")))