From: Mark Wooding Date: Sun, 30 Aug 2015 09:58:38 +0000 (+0100) Subject: src/utilities.lisp: Move `define-on-demand-slot' to the right section. X-Git-Url: https://git.distorted.org.uk/~mdw/sod/commitdiff_plain/141283ff3851f6ada772db21a496026fd8fdd76e src/utilities.lisp: Move `define-on-demand-slot' to the right section. --- diff --git a/src/utilities.lisp b/src/utilities.lisp index 98d314a..1093f68 100644 --- a/src/utilities.lisp +++ b/src/utilities.lisp @@ -713,18 +713,6 @@ `((defun (setf ,from) (value object) (setf (,to object) value)))))) -(export 'define-on-demand-slot) -(defmacro define-on-demand-slot (class slot (instance) &body body) - "Defines a slot which computes its initial value on demand. - - Sets up the named SLOT of CLASS to establish its value as the implicit - progn BODY, by defining an appropriate method on `slot-unbound'." - (with-gensyms (classvar slotvar) - `(defmethod slot-unbound - (,classvar (,instance ,class) (,slotvar (eql ',slot))) - (declare (ignore ,classvar)) - (setf (slot-value ,instance ',slot) (progn ,@body))))) - ;;;-------------------------------------------------------------------------- ;;; CLOS hacking. @@ -749,4 +737,16 @@ (setf (slot-value ,instance ,slot) (progn ,@value))))) +(export 'define-on-demand-slot) +(defmacro define-on-demand-slot (class slot (instance) &body body) + "Defines a slot which computes its initial value on demand. + + Sets up the named SLOT of CLASS to establish its value as the implicit + progn BODY, by defining an appropriate method on `slot-unbound'." + (with-gensyms (classvar slotvar) + `(defmethod slot-unbound + (,classvar (,instance ,class) (,slotvar (eql ',slot))) + (declare (ignore ,classvar)) + (setf (slot-value ,instance ',slot) (progn ,@body))))) + ;;;----- That's all, folks --------------------------------------------------