[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DEFSTRUCT copier query



What is the defined behavior of the DEFSTRUCT-created copier function in the
face of :INCLUDEd types?  For instance, given:

(defstruct bread
  (state 'freshly-baked))

(defstruct (rye-bread (:include bread))
  (seeded-p t))

is the result of evaluating:

(copy-bread (make-rye-bread :state 'stale :seeded-p nil))


	A:	#S(RYE-BREAD :STATE STALE :SEEDED-P NIL)
or
	B:	#S(BREAD :STATE STALE)

I am hoping that the correct answer is A.  A function with behavior B can be
easily implemented in Common Lisp by any user who needs it, while a function
with behavior A cannot be without hardwiring all of the subtypes (recursively)
of the structure into the function, which seems like a harsh fate.

				--Stuart A. Malone