merged AD sbcl-devel 2001-10-05 LOOP patches..
authorWilliam Harold Newman <william.newman@airmail.net>
Fri, 5 Oct 2001 17:41:31 +0000 (17:41 +0000)
committerWilliam Harold Newman <william.newman@airmail.net>
Fri, 5 Oct 2001 17:41:31 +0000 (17:41 +0000)
..Variable *LOOP-DESTRUCTURING-HOOKS* is checked three times,
but set nowhere: remove.
..Declare WITH-introduced variables.
..bug 103: Forms after INITIALLY, FINALLY, DO must be compound
forms.
added test cases for second and third patches
fixed bug in third patch: missing argument in LOOP-ERROR
tweaked suggested *SHEBANG-FEATURES* customization procedure
text sorta along the lines suggested by Nathan Froyd

CREDITS
NEWS
base-target-features.lisp-expr
src/code/loop.lisp
tests/loop.pure.lisp

diff --git a/CREDITS b/CREDITS
index 1fa39cc..51039b7 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -491,7 +491,8 @@ CREDITS SINCE THE RELEASE OF SBCL
 (Note: (1) This is probably incomplete, since there's no systematic
 procedure for updating it. (2) Some more details are available in the
 NEWS file, in the project's CVS change logs, and in the archives of
-the sbcl-devel mailing list.)
+the sbcl-devel mailing list. (3) In this, as in other parts of 
+SBCL, patches are welcome.)
 
 Martin Atzmueller:
   He reported many bugs, fixed many bugs, ported various fixes
@@ -503,12 +504,13 @@ Daniel Barlow:
   He contributed sblisp.lisp, a set of patches to make SBCL
   play nicely with ILISP. (Those patches have since disappeared from the
   SBCL distribution because ILISP has since been patched to play nicely
-  with SBCL.) He also figured out how to get the CMU CL dynamic object
-  file loading code to work under SBCL. He ported CMU CL's Alpha
-  port to SBCL. He wrote code (e.g. grovel_headers.c and
+  with SBCL.) He figured out how to get the CMU CL dynamic object
+  file loading code to work under SBCL. He ported CMU CL's support for
+  Alpha and PPC CPUs to SBCL. He wrote code (e.g. grovel_headers.c and
   stat_wrapper stuff) to handle machine-dependence and OS-dependence
   automatically, reducing the amount of hand-tweaking required to
-  keep ports synchronized. 
+  keep ports synchronized. He's also provided support for SBCL (as
+  well as for free Common Lisp in general) through his CLiki website.
 
 Cadabra, Inc. (later merged into GoTo.com):
   They hired Bill Newman to do some consulting for them,
@@ -524,9 +526,11 @@ Douglas Crosher:
   (CONS FOO BAR) types.
 
 Alexey Dejneka:
-  He has fixed many bugs in SBCL. I can't find a nice summary theme,
-  though, except that appears that at least some of them come from
-  going over the BUGS file to find outstanding problems to fix.
+  He has fixed many bugs in SBCL. There's no single summary theme, but
+  he's fixed about a dozen different bugs in LOOP alone, and it appears
+  that a lot of his fixes there and elsewhere reflect systematic
+  public-spiritedness, fixing bugs as they show up in sbcl-devel or as
+  archived in the BUGS file.
 
 Robert MacLachlan:
   He has continued to answer questions about, and contribute fixes to, 
@@ -535,11 +539,12 @@ Robert MacLachlan:
   porting, invaluable to the SBCL project as well.
 
 Bill Newman:
-  He continued to work on SBCL after the fork, increasing ANSI
+  He continued to maintain SBCL after the fork, increasing ANSI
   compliance, fixing bugs, regularizing the internals of the
   system, deleting unused extensions, improving performance in 
   some areas (especially sequence functions and non-simple vectors),
-  and updating documentation.
+  updating documentation, and even, for better or worse, getting
+  rid of various functionality (e.g. the byte interpreter).
 
 Raymond Toy:
   He continued to work on CMU CL after the SBCL fork, especially on
diff --git a/NEWS b/NEWS
index f8973bc..50ddaf0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -886,13 +886,13 @@ changes in sbcl-0.7.0 relative to sbcl-0.6.13:
   ** removing dead code
 * Alexey Dejneka fixed many bugs:
   ** misbehavior of WRITE-STRING/WRITE-LINE
-  ** LOOP over keys of a hash table
-  ** bogus entries in BUGS
+  ** LOOP over keys of a hash table, LOOP bugs 49b and 81 and 103, and
+     several other LOOP problems as well
   ** DIRECTORY when similar filenames are present
   ** DEFGENERIC with :METHOD options
   ** bug 126, in (MAKE-STRING N :INITIAL-ELEMENT #\SPACE))
   ** bug in the optimization of ARRAY-ELEMENT-TYPE
-  ** LOOP bugs 49b and 81
+  He also pointed out some bogus old entries in BUGS.
 ?? Old operator names in the style DEF-FOO are now deprecated in favor
   of new corresponding names DEFINE-FOO, for consistency with the
   naming convention used in the ANSI standard). This mostly affects
index a116e33..d6fa9a1 100644 (file)
@@ -5,8 +5,10 @@
 ;;;;
 ;;;; Note that the recommended way to customize the features of a
 ;;;; local build of SBCL is not to edit this file, but instead to
-;;;; tweak customize-target-features.lisp. E.g. you can use code like
-;;;; this:
+;;;; tweak customize-target-features.lisp. If you define a function
+;;;; in customize-target-features.lisp, it will be used to transform
+;;;; the target features list after it's read and before it's used.
+;;;; E.g. you can use code like this:
 ;;;;    (lambda (list)
 ;;;;      (flet ((enable (x) (pushnew x list))
 ;;;;            (disable (x) (setf list (remove x list))))
 ;;;;        (enable :sb-after-xc-core)
 ;;;;        #+nil (disable :sb-doc)
 ;;;;        list))
-;;;; That way, because customize-target-features.lisp is in
-;;;; .cvsignore, your local changes will remain local even if you use
-;;;; "cvs diff" to submit patches to SBCL.
+;;;; By thus editing a local file (one which is not in the source
+;;;; distribution, and which is in .cvsignore) your customizations
+;;;; will remain local even if you do things like "cvs update",
+;;;; will not show up if you try to submit a patch with "cvs diff",
+;;;; and might even stay out of the way if you use other non-CVS-based
+;;;; methods to upgrade the files or store your configuration.
 
 ;;;; This software is part of the SBCL system. See the README file for
 ;;;; more information.
index ff657b4..6b7ce2c 100644 (file)
@@ -328,12 +328,6 @@ code to be loaded.
 \f
 ;;;; SETQ hackery
 
-(defvar *loop-destructuring-hooks*
-       nil
-  #!+sb-doc
-  "If not NIL, this must be a list of two things:
-a LET-like macro, and a SETQ-like macro, which perform LOOP-style destructuring.")
-
 (defun loop-make-psetq (frobs)
   (and frobs
        (loop-make-desetq
@@ -345,10 +339,7 @@ a LET-like macro, and a SETQ-like macro, which perform LOOP-style destructuring.
 (defun loop-make-desetq (var-val-pairs)
   (if (null var-val-pairs)
       nil
-      (cons (if *loop-destructuring-hooks*
-               (cadr *loop-destructuring-hooks*)
-               'loop-really-desetq)
-           var-val-pairs)))
+      (cons 'loop-really-desetq var-val-pairs)))
 
 (defvar *loop-desetq-temporary*
        (make-symbol "LOOP-DESETQ-TEMP"))
@@ -824,11 +815,7 @@ a LET-like macro, and a SETQ-like macro, which perform LOOP-style destructuring.
            (let ((forms (list answer)))
              ;;(when crocks (push crocks forms))
              (when dcls (push `(declare ,@dcls) forms))
-             (setq answer `(,(cond ((not vars) 'locally)
-                                   (*loop-destructuring-hooks*
-                                    (first *loop-destructuring-hooks*))
-                                   (t
-                                    'let))
+             (setq answer `(,(if vars 'let 'locally)
                             ,vars
                             ,@(loop-build-destructuring-bindings crocks
                                                                  forms)))))))
@@ -866,17 +853,25 @@ a LET-like macro, and a SETQ-like macro, which perform LOOP-style destructuring.
       (pop *loop-source-code*)
       (loop-error "LOOP source code ran out when another token was expected.")))
 
-(defun loop-get-progn ()
-  (do ((forms (list (loop-pop-source)) (cons (loop-pop-source) forms))
-       (nextform (car *loop-source-code*) (car *loop-source-code*)))
-      ((atom nextform)
-       (if (null (cdr forms)) (car forms) (cons 'progn (nreverse forms))))))
-
 (defun loop-get-form ()
   (if *loop-source-code*
       (loop-pop-source)
       (loop-error "LOOP code ran out where a form was expected.")))
 
+(defun loop-get-compound-form ()
+  (let ((form (loop-get-form)))
+    (unless (consp form)
+      (loop-error "A compound form was expected, but ~S found." form))
+    form))
+
+(defun loop-get-progn ()
+  (do ((forms (list (loop-get-compound-form))
+              (cons (loop-get-compound-form) forms))
+       (nextform (car *loop-source-code*)
+                 (car *loop-source-code*)))
+      ((atom nextform)
+       (if (null (cdr forms)) (car forms) (cons 'progn (nreverse forms))))))
+
 (defun loop-construct-return (form)
   `(return-from ,(car *loop-names*) ,form))
 
@@ -1016,14 +1011,12 @@ a LET-like macro, and a SETQ-like macro, which perform LOOP-style destructuring.
         (push (list name (or initialization (loop-typed-init dtype)))
               *loop-variables*))
        (initialization
-        (cond (*loop-destructuring-hooks*
-               (loop-declare-variable name dtype)
-               (push (list name initialization) *loop-variables*))
-              (t (let ((newvar (gensym "LOOP-DESTRUCTURE-")))
-                   (push (list newvar initialization) *loop-variables*)
-                   ;; *LOOP-DESETQ-CROCKS* gathered in reverse order.
-                   (setq *loop-desetq-crocks*
-                     (list* name newvar *loop-desetq-crocks*))))))
+        (let ((newvar (gensym "LOOP-DESTRUCTURE-")))
+           (loop-declare-variable name dtype)
+           (push (list newvar initialization) *loop-variables*)
+           ;; *LOOP-DESETQ-CROCKS* gathered in reverse order.
+           (setq *loop-desetq-crocks*
+                 (list* name newvar *loop-desetq-crocks*))))
        (t (let ((tcar nil) (tcdr nil))
             (if (atom dtype) (setq tcar (setq tcdr dtype))
                 (setq tcar (car dtype) tcdr (cdr dtype)))
index 46a38e8..66f7f34 100644 (file)
               (loop with (a . b) of-type float = '(0.0 . 1.0)
                     and (c . d) of-type float = '(2.0 . 3.0)
                     return (list a b c d))))
+
+;;; a bug reported and fixed by Alexey Dejneka sbcl-devel 2001-10-05:
+;;; The type declarations should apply, hence under Python's
+;;; declarations-are-assertions rule, the code should signal a type
+;;; error.
+(assert (typep (nth-value 1
+                         (ignore-errors
+                           (funcall (lambda ()
+                                      (loop with (a . b)
+                                            of-type float = '(5 . 5)
+                                            return (list a b))))))
+              'type-error))
+
+;;; bug 103, reported by Arthur Lemmens sbcl-devel 2001-05-05,
+;;; fixed by Alexey Dejneka patch sbcl-devel 2001-10-05:
+;;; LOOP syntax requires that forms after INITIALLY, FINALLY, and DO
+;;; must be compound forms.
+(multiple-value-bind (function warnings-p failure-p)
+    (compile nil
+            '(lambda ()
+               (loop while t do
+                     *print-level*
+                     (print t))))
+  (declare (ignore function warnings-p))
+  (assert failure-p))