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

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


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

Modified Files:
	defstruct.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:17 2004
Author: ffjeld

Index: movitz/losp/muerte/defstruct.lisp
diff -u movitz/losp/muerte/defstruct.lisp:1.6 movitz/losp/muerte/defstruct.lisp:1.7
--- movitz/losp/muerte/defstruct.lisp:1.6	Sun Apr 18 19:16:49 2004
+++ movitz/losp/muerte/defstruct.lisp	Mon Apr 19 18:38:16 2004
@@ -9,7 +9,7 @@
 ;;;; Created at:    Mon Jan 22 13:10:59 2001
 ;;;; Distribution:  See the accompanying file COPYING.
 ;;;;                
-;;;; $Id: defstruct.lisp,v 1.6 2004/04/18 23:16:49 ffjeld Exp $
+;;;; $Id: defstruct.lisp,v 1.7 2004/04/19 22:38:16 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -294,7 +294,11 @@
 			   (slot-number ,slot-number)))
 		(defclass ,struct-name (structure-object) ()
 			  (:metaclass structure-class)
-			  (:slots ,canonical-slot-descriptions))
+			  (:slots ,(loop for (name) in canonical-slot-descriptions
+				       as location upfrom 0
+				       collect (movitz-make-instance 'structure-slot-definition
+								     :name name
+								     :location location))))
 		',struct-name))
 	    (list
 	     `(progn
@@ -332,10 +336,3 @@
 (defun structure-object-name (x)
   (movitz-accessor x movitz-struct name))
 
-(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))))





More information about the Movitz-cvs mailing list