From 141283ff3851f6ada772db21a496026fd8fdd76e Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 30 Aug 2015 10:58:38 +0100 Subject: [PATCH] src/utilities.lisp: Move `define-on-demand-slot' to the right section. --- src/utilities.lisp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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 -------------------------------------------------- -- 2.11.0