From: Gary Hooyman
Subject: making load form of a 'defclass
Date: 
Message-ID: <AeQ7Ev200iQQQ7dUcz@andrew.cmu.edu>
Hi,

I am using lucid 4.0 with clos for a project and require that instances
be able to print a representation of the class they belong to.  I use
some mop to get to the slots of the class.  The objects that make up the
initforms of the slots are of type 'data-item (a class hierarchy of
specialized data items) and have a method called "lisp-script" that
prints a representation of the object in an evaluatable expression.

Here's an example interaction with the class;


----------------------------------------
(make-dynamic-design-object-class 'gary)
 (setf g (make-instance 'gary))
 (setf *print-length* 500)
500
->-> (lisp-script-defclass-form g)
(DEFCLASS GARY (DYNAMIC-DESIGN-OBJECT-CLASS) NIL (:DOCUMENTATION ""))
->-> (add-di 'd 'function-item g)
#<Standard-Class GARY>
->-> (lisp-script-defclass-form g)
(DEFCLASS GARY (DYNAMIC-DESIGN-OBJECT-CLASS) ((D :ALLOCATION :INSTANCE
:INITARG :
D :INITFORM # :READER D :WRITER #)) (:DOCUMENTATION ""))
->-> (d g)
#<Function-Item #X10D42EAE>
->-> (lisp-script (d g))
(MAKE-INSTANCE (QUOTE USER-QUERY) :NAME D :DEPENDENTS (QUOTE NIL)
:SYMBOLIC-EXPRE
SSION NIL)
----------------------------------------------

The initform, initarg, reader, and writer did not print as they were
supposed to!  In their place we find the '#'.  But... after I return
from the debugger, everything works fine (for a while):

-------------------------------------------------

> (lisp-script-defclass-form g)
(DEFCLASS GARY (DYNAMIC-DESIGN-OBJECT-CLASS) ((D :ALLOCATION :INSTANCE
:INITARG :
D :INITFORM (MAKE-INSTANCE (QUOTE USER-QUERY) :NAME D :DEPENDENTS (QUOTE
NIL) :SY
MBOLIC-EXPRESSION NIL) :READER D :WRITER (SETF D))) (:DOCUMENTATION ""))
> (eval (lisp-script-defclass-form g)
)
#<Standard-Class GARY>
> (pprint (lisp-script-defclass-form g))

(DEFCLASS GARY
          (DYNAMIC-DESIGN-OBJECT-CLASS)
          ((D :ALLOCATION
              :INSTANCE
              :INITARG
              :D
              :INITFORM
              (MAKE-INSTANCE 'USER-QUERY
                             :NAME
                             D
                             :DEPENDENTS
                             'NIL
                             :SYMBOLIC-EXPRESSION
                             NIL)
              :READER
              D
              :WRITER
              (SETF D)))
          (:DOCUMENTATION ""))
>
------------------------------------------------

What is happening here that I am unaware of?
Is this something with the Lucid debugger?
How can I reliably script object representations s.t. 
I can save to disk or redefine classes?


thank you for your help


Gary Hooyman
Department of Civil Engineering
Carnegie Mellon University
Pittsburgh, PA