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

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Mon Apr 19 22:38:33 UTC 2004


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

Modified Files:
	more-macros.lisp 
Log Message:
Changed structure-class and defstruct so as to be better integrated
with the MOP. This means that the slot-value accessor should now work
on structure-objects.

Date: Mon Apr 19 18:38:33 2004
Author: ffjeld

Index: movitz/losp/muerte/more-macros.lisp
diff -u movitz/losp/muerte/more-macros.lisp:1.6 movitz/losp/muerte/more-macros.lisp:1.7
--- movitz/losp/muerte/more-macros.lisp:1.6	Mon Apr 19 16:01:08 2004
+++ movitz/losp/muerte/more-macros.lisp	Mon Apr 19 18:38:33 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.6 2004/04/19 20:01:08 ffjeld Exp $
+;;;; $Id: more-macros.lisp,v 1.7 2004/04/19 22:38:33 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -292,6 +292,14 @@
 (defmacro ignore-errors (&body body)
   `(handler-case (progn , at body)
      (error (c) (values nil c))))
+
+(defmacro with-accessors (slot-entries instance-form &body declarations-and-forms)
+  (let ((instance-variable (gensym "with-accessors-instance-")))
+    `(let ((,instance-variable ,instance-form))
+       (declare (ignorable ,instance-variable))
+       (symbol-macrolet ,(loop for (variable-name accessor-name) in slot-entries
+			     collecting `(,variable-name (,accessor-name ,instance-variable)))
+	 , at declarations-and-forms))))
 
 (defmacro with-slots (slot-entries instance-form &body declarations-and-forms)
   (let ((object-var (gensym "with-slots-object-")))





More information about the Movitz-cvs mailing list