home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / lisp / 2099 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  3.1 KB

  1. Xref: sparky comp.lang.lisp:2099 comp.lang.clos:590
  2. Organization: Masters student, Civil Engineering, Carnegie Mellon, Pittsburgh, PA
  3. 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+
  4. Newsgroups: comp.lang.lisp,comp.lang.clos
  5. Message-ID: <AeQ7Ev200iQQQ7dUcz@andrew.cmu.edu>
  6. Date: Fri, 24 Jul 1992 17:20:59 -0400 
  7. From: Gary Hooyman <gh1h+@andrew.cmu.edu>
  8. Subject: making load form of a 'defclass
  9. Lines: 85
  10.  
  11. Hi,
  12.  
  13. I am using lucid 4.0 with clos for a project and require that instances
  14. be able to print a representation of the class they belong to.  I use
  15. some mop to get to the slots of the class.  The objects that make up the
  16. initforms of the slots are of type 'data-item (a class hierarchy of
  17. specialized data items) and have a method called "lisp-script" that
  18. prints a representation of the object in an evaluatable expression.
  19.  
  20. Here's an example interaction with the class;
  21.  
  22.  
  23. ----------------------------------------
  24. (make-dynamic-design-object-class 'gary)
  25.  (setf g (make-instance 'gary))
  26.  (setf *print-length* 500)
  27. 500
  28. ->-> (lisp-script-defclass-form g)
  29. (DEFCLASS GARY (DYNAMIC-DESIGN-OBJECT-CLASS) NIL (:DOCUMENTATION ""))
  30. ->-> (add-di 'd 'function-item g)
  31. #<Standard-Class GARY>
  32. ->-> (lisp-script-defclass-form g)
  33. (DEFCLASS GARY (DYNAMIC-DESIGN-OBJECT-CLASS) ((D :ALLOCATION :INSTANCE
  34. :INITARG :
  35. D :INITFORM # :READER D :WRITER #)) (:DOCUMENTATION ""))
  36. ->-> (d g)
  37. #<Function-Item #X10D42EAE>
  38. ->-> (lisp-script (d g))
  39. (MAKE-INSTANCE (QUOTE USER-QUERY) :NAME D :DEPENDENTS (QUOTE NIL)
  40. :SYMBOLIC-EXPRE
  41. SSION NIL)
  42. ----------------------------------------------
  43.  
  44. The initform, initarg, reader, and writer did not print as they were
  45. supposed to!  In their place we find the '#'.  But... after I return
  46. from the debugger, everything works fine (for a while):
  47.  
  48. -------------------------------------------------
  49.  
  50. > (lisp-script-defclass-form g)
  51. (DEFCLASS GARY (DYNAMIC-DESIGN-OBJECT-CLASS) ((D :ALLOCATION :INSTANCE
  52. :INITARG :
  53. D :INITFORM (MAKE-INSTANCE (QUOTE USER-QUERY) :NAME D :DEPENDENTS (QUOTE
  54. NIL) :SY
  55. MBOLIC-EXPRESSION NIL) :READER D :WRITER (SETF D))) (:DOCUMENTATION ""))
  56. > (eval (lisp-script-defclass-form g)
  57. )
  58. #<Standard-Class GARY>
  59. > (pprint (lisp-script-defclass-form g))
  60.  
  61. (DEFCLASS GARY
  62.           (DYNAMIC-DESIGN-OBJECT-CLASS)
  63.           ((D :ALLOCATION
  64.               :INSTANCE
  65.               :INITARG
  66.               :D
  67.               :INITFORM
  68.               (MAKE-INSTANCE 'USER-QUERY
  69.                              :NAME
  70.                              D
  71.                              :DEPENDENTS
  72.                              'NIL
  73.                              :SYMBOLIC-EXPRESSION
  74.                              NIL)
  75.               :READER
  76.               D
  77.               :WRITER
  78.               (SETF D)))
  79.           (:DOCUMENTATION ""))
  80. >
  81. ------------------------------------------------
  82.  
  83. What is happening here that I am unaware of?
  84. Is this something with the Lucid debugger?
  85. How can I reliably script object representations s.t. 
  86. I can save to disk or redefine classes?
  87.  
  88.  
  89. thank you for your help
  90.  
  91.  
  92. Gary Hooyman
  93. Department of Civil Engineering
  94. Carnegie Mellon University
  95. Pittsburgh, PA
  96.