home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.lisp:2099 comp.lang.clos:590
- Organization: Masters student, Civil Engineering, Carnegie Mellon, Pittsburgh, PA
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!fs7.ece.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!gh1h+
- Newsgroups: comp.lang.lisp,comp.lang.clos
- Message-ID: <AeQ7Ev200iQQQ7dUcz@andrew.cmu.edu>
- Date: Fri, 24 Jul 1992 17:20:59 -0400
- From: Gary Hooyman <gh1h+@andrew.cmu.edu>
- Subject: making load form of a 'defclass
- Lines: 85
-
- 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
-