Replaces the values in a CLOS object's slots by the values of slots from another object.
clos
replace-standard-object target source => target
A standard-object, but not a funcallable-standard-object. |
target |
A standard-object, but not a funcallable-standard-object. |
The function replace-standard-object
replaces the values in the slots of the CLOS object target by the values of slots from the CLOS object source.
Only slots with allocation type :instance
are copied from source to target.
source and target must be of type standard-object, excluding funcallable-standard-object and its subclasses, in particular they cannot be of type generic-function. Moreover both must be of the same class, that is:
(eq (class-of target) (class-of source)) => t
The replacement is shallow, that is only the actual values are copied, as if by:
(dolist (slot instance-slots) (setf (slot-value target slot) (slot-value source slot)))
assuming no definition that affects what slot-value and (setf slot-value)
do. However, replace-standard-object
bypasses the slot-value mechanism and is much faster.
replace-standard-object
should be used on instances of user-defined classes which do not inherit from system-defined classes (other than standard-object). It should never be used on instances of system-defined classes and their subclasses.
The return value is eq to the argument target.
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:25