home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.lisp:2067 comp.lang.clos:584
- Path: sparky!uunet!usc!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!princeton!siemens!volvo!mlg
- From: mlg@siemens.com. (Michael Greenberg)
- Newsgroups: comp.lang.lisp,comp.lang.clos
- Subject: Beware of print-object methods when debugging
- Message-ID: <mlg.711741357@volvo>
- Date: 21 Jul 92 17:55:57 GMT
- Sender: news@siemens.siemens.com
- Followup-To: comp.lang.lisp
- Lines: 34
-
-
- A coworker came into my office this morning to ask for help debugging
- his program. The bug seemed to be in a part of the program that did
- processing nodes in a graph. The code seemed to work correctly for all
- objects (about 1000 of them) except for one.
-
- Somewhere in the code there was a statement like:
-
- (setf (node-a node) (make-instance 'foo ...))
-
- We would do something like
-
- (dolist (node (all-objects-in-tree))
- (print (node-a node)))
-
- and see the expected results except for one object where 'NIL' was
- printed. The code was pretty complex and there were all sorts of
- dependencies between the various objects in the system, so it wasn't
- surprising that that was an error somewhere.
-
- I beat on this for a while trying to figure out what was
- going on. 30 minutes later he said "By the way, I also have a
- question about print-object...".
-
- It turns out the problem was that his print-object method for the
- class 'foo' sometimes printed 'NIL'.
-
-
-
- --
- Michael Greenberg email: mgreenberg@siemens.com
- Siemens Corporate Research phone: 609-734-3347
- 755 College Road East
- Princeton, NJ 08540
-