[cl-utilities-cvs] CVS update: cl-utilities/with-unique-names.lisp

Peter Scott pscott at common-lisp.net
Mon May 16 19:12:01 UTC 2005


Update of /project/cl-utilities/cvsroot/cl-utilities
In directory common-lisp.net:/tmp/cvs-serv1864

Modified Files:
	with-unique-names.lisp 
Log Message:
Improved documentation and type checking. Cleaned up code a little.

Date: Mon May 16 21:12:00 2005
Author: pscott

Index: cl-utilities/with-unique-names.lisp
diff -u cl-utilities/with-unique-names.lisp:1.2 cl-utilities/with-unique-names.lisp:1.3
--- cl-utilities/with-unique-names.lisp:1.2	Fri May 13 23:18:23 2005
+++ cl-utilities/with-unique-names.lisp	Mon May 16 21:12:00 2005
@@ -10,7 +10,11 @@
 			 (if (consp binding)
 			     binding
 			     (list binding binding))
-                       `(,var (gensym ,(format nil "~A" prefix)))))
+		       (if (symbolp var)
+			   `(,var (gensym ,(format nil "~A" prefix)))
+			   (error 'type-error
+				  :datum var
+				  :expected-type 'symbol))))
                  bindings)
     , at body))
 
@@ -28,7 +32,11 @@
 
 (defmacro with-gensyms ((&rest bindings) &body body)
   "Synonym for WITH-UNIQUE-NAMES, but BINDINGS should only consist of
-atoms; lists are not supported."
+atoms; lists are not supported. If you try to give list bindings, a
+LIST-BINDING-NOT-SUPPORTED warning will be signalled, but it will work
+the same way as WITH-UNIQUE-NAMES. Don't do it, though."
+  ;; Signal a warning for each list binding, if there are any
   (dolist (binding (remove-if-not #'listp bindings))
     (warn 'list-binding-not-supported :binding binding))
+  ;; Otherwise, this is a synonym for WITH-UNIQUE-NAMES
   `(with-unique-names ,bindings , at body))




More information about the Cl-utilities-cvs mailing list