src/pset-proto.lisp (default-slot-from-property): Maybe leave slot unbound.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 13:27:39 +0000 (14:27 +0100)
If there are no DEFAULT-VALUE forms, and the property isn't set, then
leave the slot unbound.

src/pset-proto.lisp

index e16e04c..61793b5 100644 (file)
    We initialize SLOT in INSTANCE.  In full: if PSET contains a property
    called NAME, then convert it to TYPE, bind the value to PVAR and evaluate
    CONVERT-FORMS -- these default to just using the property value.  If
-   there's no property, and the slot is named in SLOT-NAMES and currently
+   there's no property, and DEFAULT-FORMS contains at least one non-
+   declaration form, and the slot is named in SLOT-NAMES and currently
    unbound, then evaluate DEFAULT-FORMS and use their value to compute the
    slot value."
 
               (setf (slot-value ,instance ,slot)
                     (with-default-error-location (,floc)
                       ,@(or convert-forms `(,pvar))))
-              (default-slot (,instance ,slot ,slot-names)
-                ,@body)))))))
+              ,@(and body
+                     `((default-slot (,instance ,slot ,slot-names)
+                         ,@body)))))))))
 
 ;;;----- That's all, folks --------------------------------------------------