Additional useful methods defined on the base subclass are:
Make a copy of obj, and then apply params. params is a parameter list of the same form as initialize-instance which are applied to change the object. When overloading clone, be sure to call call-next-method first and modify the returned object.
Pretty printer for object this. Call function eieio-object-name with strings. The default method for printing object this is to use the function eieio-object-name.
It is sometimes useful to put a summary of the object into the default #<notation> string when using eieio browsing tools.
Implement this function and specify strings in a call to call-next-method to provide additional summary information. When passing in extra strings from child classes, always remember to prepend a space.
(defclass data-object () (value) "Object containing one data slot.") (defmethod object-print ((this data-object) &optional strings) "Return a string with a summary of the data object as part of the name." (apply 'call-next-method this (cons (format " value: %s" (render this)) strings)))
Here is what some output could look like:
(object-print test-object) => #<data-object test-object value: 3>
Write obj onto a stream in a readable fashion. The resulting
output will be Lisp code which can be used with
eval to recover the object. Only slots with
are written to the stream.