Skip to content

Commit 21afffe

Browse files
committed
Added defun (setf slot-value), rename rotatef -> !rotatef
1. moved from std-object.lisp 2. dumb impl, only for local used, but not standard function
1 parent f9e5946 commit 21afffe

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/clos/methods.lisp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
(defvar *mop-awake-time* (get-internal-real-time))
1414

1515

16+
;;; @vlad-km.
17+
;;; moved from std-object.
18+
(defun (setf slot-value) (new-value object slot-name)
19+
(if (eq (!class-of (!class-of object)) *the-class-standard-class*)
20+
(setf-std-slot-value object slot-name new-value)
21+
(setf-slot-value-using-class new-value (!class-of object) object slot-name)))
22+
1623

1724
;;; print-object
1825
(defgeneric print-object (instance &optional stream))
@@ -145,10 +152,10 @@
145152
(slot-boundp old-instance slot-name))
146153
(setf (slot-value new-instance slot-name)
147154
(slot-value old-instance slot-name))))
148-
(rotatef (std-instance-slots new-instance)
149-
(std-instance-slots old-instance))
150-
(rotatef (std-instance-class new-instance)
151-
(std-instance-class old-instance))
155+
(!rotatef (std-instance-slots new-instance)
156+
(std-instance-slots old-instance))
157+
(!rotatef (std-instance-class new-instance)
158+
(std-instance-class old-instance))
152159
(apply #'update-instance-for-different-class
153160
new-instance old-instance initargs)
154161
old-instance))

0 commit comments

Comments
 (0)