[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
; The following illustrates the problem I am encountering with #n= in
; output. Because the call to write calls the format in the defstruct
; print routine, the #n= count is reset between defstruct prints, resulting
; in both structures using #0= to define their shared substructure and making
; it impossible to read the list back in.
; This is apparently a shortcoming of the original definition of CL. Page
; 559 of CLtLII alludes to the problem.
(defstruct (sister-ship (:print-function print-sister-ship)) class members )
(defstruct (ship) hms )
(defun print-sister-ship (x stream depth)
"#s(sister-ship class ~s members ~s)"
(defun bug ()
(setf x (make-ship :hms 'santa-maria))
,(make-sister-ship :class 'nina
:members `(,(symbol-value 'x),(symbol-value 'x)))
,(make-sister-ship :class 'pinta
:members `(,(symbol-value 'x),(symbol-value 'x))))
:stream (open "bug" :direction :output)