[movitz-cvs] CVS update: movitz/losp/muerte/more-macros.lisp

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Mon Apr 19 20:01:09 UTC 2004


Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory common-lisp.net:/tmp/cvs-serv11801

Modified Files:
	more-macros.lisp 
Log Message:
Added macro with-slots.

Date: Mon Apr 19 16:01:08 2004
Author: ffjeld

Index: movitz/losp/muerte/more-macros.lisp
diff -u movitz/losp/muerte/more-macros.lisp:1.5 movitz/losp/muerte/more-macros.lisp:1.6
--- movitz/losp/muerte/more-macros.lisp:1.5	Tue Apr  6 10:05:23 2004
+++ movitz/losp/muerte/more-macros.lisp	Mon Apr 19 16:01:08 2004
@@ -10,7 +10,7 @@
 ;;;; Author:        Frode Vatvedt Fjeld <frodef at acm.org>
 ;;;; Created at:    Fri Jun  7 15:05:57 2002
 ;;;;                
-;;;; $Id: more-macros.lisp,v 1.5 2004/04/06 14:05:23 ffjeld Exp $
+;;;; $Id: more-macros.lisp,v 1.6 2004/04/19 20:01:08 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -292,3 +292,13 @@
 (defmacro ignore-errors (&body body)
   `(handler-case (progn , at body)
      (error (c) (values nil c))))
+
+(defmacro with-slots (slot-entries instance-form &body declarations-and-forms)
+  (let ((object-var (gensym "with-slots-object-")))
+    `(symbol-macrolet ,(mapcar (lambda (entry)
+				 (let ((var (if (atom entry) entry (car entry)))
+				       (slot (if (atom entry) entry (cadr entry))))
+				   `(,var (slot-value ,object-var ',slot))))
+			       slot-entries)
+       (let ((,object-var ,instance-form))
+	 , at declarations-and-forms))))
\ No newline at end of file





More information about the Movitz-cvs mailing list