(defclass restore-to-data-structure-mixin () ()) (defclass some-class (restore-to-data-structure-mixin) ()) (defclass some-class2 (restore-to-data-structure-mixin) ()) (defgeneric restore-to-data-structure (object)) (defmethod initialize-instance :around ((uninitialized restore-to-data-structure-mixin) &rest initargs &key ((restore-to-data-structure restore-to-data-structure)) &allow-other-keys) (declare (ignore initargs)) (let ((initialized-instance (call-next-method))) (when restore-to-data-structure (restore-to-data-structure initialized-instance) initialized-instance))) ;;; now we don't have to bother with initialize-instance :around for each class ;;; it's enough for all of them to inherit restore-to-data-structure-mixin and have ;;; restore-to-data-structure methods defined (defmethod restore-to-data-structure ((object some-class)) (format t "~A was read from the database and restored into the right data structure.~%" object)) (defmethod restore-to-data-structure ((object some-class2)) (format t "~A was read from the database and restored etc similar story~%" object)) (make-instance 'some-class) ; no output on *standard-output* (make-instance 'some-class 'restore-to-data-structure t) ; # was read from the database and restored into the right data structure. (make-instance 'some-class2 'restore-to-data-structure t) ; # was read from the database and restored etc similar story