anchor.diff:  ;; sheep-creation.lisp
   ;;
   ;; Sheep creation, cloning, inspection
  +;;
  +;; TODO - write validate-hierarchy-list, which could be called whenever the parents list changes.
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (in-package :sheeple)
   (declaim (optimize (debug 1) (safety 1) (speed 3)))
   
  +;; We declare these base vars here so that bootstrapping won't complain.
   (defvar =t=)
   (defvar =dolly=)
  +
  +;;;
  +;;; Sheeple object
  +;;;
   (defclass standard-sheep ()
  -  ((nickname :accessor sheep-nickname :initform nil)
  -   (documentation :accessor sheep-documentation :initform "")
  -   (direct-parents :accessor sheep-parents :initform nil :initarg :direct-parents)
  -   (%direct-children :accessor %direct-children
  -                     :initform  (make-weak-hash-table :weakness :key :test #'eq))
  +  (;;; Core slots
  +   (nickname :accessor sheep-nickname :initform nil
  +             :documentation "Displayed nickname")
  +   (documentation :accessor sheep-documentation :initform ""
  +                  :documentation "Docstring for this sheep.")
  +   (parents :accessor sheep-parents :initform nil :initarg :direct-parents
  +            :documentation "Parents of this sheep object.")
      (property-value-table :accessor sheep-property-value-table
                            :initform (make-hash-table :test #'eq))
      (property-metaobject-table :accessor sheep-property-metaobject-table
                           :initform (make-hash-table :test #'eq))
      (direct-roles :accessor sheep-direct-roles :initform nil)
  -   (hierarchy-list :accessor sheep-hierarchy-list :initform nil)))
  +   ;;; Extra slots for backstage tricks.
  +   ;; The reason we keep these references is to alert children recursively whenever the
  +   ;; hierarchy-list changes for a sheep, which means we can memoize the thing.
  +   (%children :accessor %children :initform  (make-weak-hash-table :weakness :key :test #'eq)
  +              :documentation "This is a special slot kept around mostly to make memoization
  +                              easy (possible?) by keeping references to children.")
  +   ;; I think the following would be unnecessary if there was a generator that spit out the
  +   ;; sheep's parents one by one that the implementation could use, instead of either
  +   ;; recalculating the whole thing each time, or saving the whole thing.
  +   (hierarchy-list :accessor sheep-hierarchy-list :initform nil
  +                   :documentation "A pre-calculated hierarchy list, so we don't have to run all
  +                                   of sheep-direct-parents every time.")))
   
   (defun allocate-sheep (&optional (class 'standard-sheep))
     (make-instance class))
   
  -(defgeneric sheep-p (obj))
  -(defmethod sheep-p (obj)
  -  (declare (ignore obj))
  -  nil)
  -(defmethod sheep-p ((obj standard-sheep))
  -  (declare (ignore obj))
  -  t)
  +(defgeneric sheep-p (obj)
  +  (:method (obj) (declare (ignore obj)) nil)
  +  (:method ((obj standard-sheep)) (declare (ignore obj)) t))
   
   ;;;
   ;;; Cloning
   ;;;
  +(defgeneric copy-sheep (model)
  +  ;; todo
  +  (:documentation "Makes a direct copy of MODEL."))
  +
  +(defgeneric finalize-sheep (sheep)
  +  (:documentation "Performs any needed finalization on SHEEP."))
  +
   (defun spawn-sheep (sheep-or-sheeple &rest all-keys
                       &key (metaclass 'standard-sheep)
                       &allow-other-keys)
  
positive.code:   "Creates a new standard-sheep object with SHEEPLE as its parents."
    (spawn-sheep sheeple))
  
  (defgeneric copy-sheep (model))
  (defmethod copy-sheep ((model standard-sheep))
    ;; TODO - this is bad.
    (let* ((parents (sheep-parents model))
           (properties (sheep-property-value-table model))
           (roles (sheep-direct-roles model))
           (new-sheep (clone parents)))
      (setf (sheep-property-value-table new-sheep)
            properties)
      (setf (sheep-direct-roles new-sheep)
            roles)
      new-sheep))
  
  (defgeneric finalize-sheep (sheep))
  (defmethod finalize-sheep ((sheep standard-sheep))
    (loop for parent in (sheep-parents sheep)
       do (setf (gethash sheep (%direct-children parent)) t))
    (memoize-sheep-hierarchy-list sheep)
    sheep)
  
  ;;; Inheritance setup
  (defgeneric add-parent (new-parent sheep))
  (defmethod add-parent (unsheepish-parent (child standard-sheep))
    (add-parent (sheepify unsheepish-parent) child))
  (defmethod add-parent ((new-parent standard-sheep) (child standard-sheep))
    (cond ((equal new-parent child)
           (error "Sheeple cannot be parents of themselves."))
          ((member new-parent (sheep-parents child))
  
negative.code:     (maphash (lambda (descendant iggy)
                 (declare (ignore iggy))
                 (memoize-sheep-hierarchy-list descendant))
               (%children sheep))))
  
  ;;;
  ;;; DEFCLONE macro
  