[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How do you override CLOS:PRINT-OBJECT?
I have an application that was written under Release 7.2 using Xerox's
Public domain CLOS (PCL - May Day version). It's a Telemetry processing
system that uses thousands of CLOS objects of Class MEASUREMENT in our
package SPORT - (Smart Processing of Real Time Telemetry). The system
attempts to process and display them graphically. To aid in debugging,
we wanted to change the default PRINT-OBJECT method to print additional
name information utilizing a NAME slot in the object. In PCL we were
defining the method as follows:
#+PCL
CLOS:(defmethod print-object ((m sport::measurement) stream &rest ignore)
(format stream "#<~A-~A>"
(class-name (class-of m))
(sport::m-name m)))
When we attempted to port the code to Release 8.0, this method fails to
compile. I've tried different variations but nothing seems to work.
;;; Gets you Error - Attempt to access not existent symbol CLOS:M
CLOS:(defmethod print-object ((m sport::measurement) stream &rest ignore)
(format stream "#<~A-~A>"
(class-name (class-of m))
(sport::m-name m)))
;;; Gets you Error - Lambda lists arn't congruent
(CLOS:defmethod CLOS:print-object ((m SPORT::measurement) stream &rest ignore)
(format stream "#<~A-~A>"
(CLOS:class-name (CLOS:class-of m))
(sport::m-name m)))
;;; compiles but isn't called when the object attempts to print itself
(CLOS:defmethod print-object ((m SPORT::measurement) stream &rest ignore)
(format stream "#<~A-~A>"
(CLOS:class-name (CLOS:class-of m))
(sport::m-name m)))