0.6.11.29:
[sbcl.git] / src / code / defstruct.lisp
index 8246414..8ea7dae 100644 (file)
@@ -11,6 +11,8 @@
 ;;;; files for more information.
 
 (in-package "SB!KERNEL")
+
+(/show0 "code/defstruct.lisp 15")
 \f
 ;;;; getting LAYOUTs
 
 ;;;; the legendary DEFSTRUCT macro itself (both CL:DEFSTRUCT and its
 ;;;; close personal friend SB!XC:DEFSTRUCT)
 
-;;; Return a list of forms to install print and make-load-form funs, mentioning
-;;; them in the expansion so that they can be compiled.
+;;; Return a list of forms to install PRINT and MAKE-LOAD-FORM funs,
+;;; mentioning them in the expansion so that they can be compiled.
 (defun class-method-definitions (defstruct)
   (let ((name (dd-name defstruct)))
     `((locally
        ,@(let ((def-con (dd-default-constructor defstruct)))
            (when (and def-con (not (dd-alternate-metaclass defstruct)))
              `((setf (structure-class-constructor (sb!xc:find-class ',name))
-                     #',def-con))))
-       ;; FIXME: MAKE-LOAD-FORM is supposed to be handled here, too.
-       ))))
+                     #',def-con))))))))
 ;;; FIXME: I really would like to make structure accessors less special,
 ;;; just ordinary inline functions. (Or perhaps inline functions with special
 ;;; compact implementations of their expansions, to avoid bloating the system.)
        (if (class-structure-p dd)
           (let ((inherits (inherits-for-structure dd)))
             `(progn
+               (/noshow0 "doing CLASS-STRUCTURE-P case for DEFSTRUCT " ,name)
                (eval-when (:compile-toplevel :load-toplevel :execute)
                  (%compiler-only-defstruct ',dd ',inherits))
                (%defstruct ',dd ',inherits)
                ,@(when (eq (dd-type dd) 'structure)
                    `((%compiler-defstruct ',dd)))
+               (/noshow0 "starting not-for-the-xc-host section in DEFSTRUCT")
                ,@(unless expanding-into-code-for-xc-host-p
                    (append (raw-accessor-definitions dd)
                            (predicate-definitions dd)
                                        ;(copier-definition dd)
                            (constructor-definitions dd)
                            (class-method-definitions dd)))
+               (/noshow0 "done with DEFSTRUCT " ,name)
                ',name))
           `(progn
+             (/show0 "doing NOT CLASS-STRUCTURE-P case for DEFSTRUCT " ,name)
              (eval-when (:compile-toplevel :load-toplevel :execute)
                (setf (info :typed-structure :info ',name) ',dd))
              ,@(unless expanding-into-code-for-xc-host-p
                          (typed-predicate-definitions dd)
                          (typed-copier-definitions dd)
                          (constructor-definitions dd)))
+             (/noshow0 "done with DEFSTRUCT " ,name)
              ',name)))))
 
 (sb!xc:defmacro defstruct (name-and-options &rest slot-descriptions)
   #!+sb-doc
   "DEFSTRUCT {Name | (Name Option*)} {Slot | (Slot [Default] {Key Value}*)}
-   Define the structure type Name. Instances are created by MAKE-<name>, which
-   takes keyword arguments allowing initial slot values to the specified.
+   Define the structure type Name. Instances are created by MAKE-<name>, 
+   which takes &KEY arguments allowing initial slot values to the specified.
    A SETF'able function <name>-<slot> is defined for each slot to read and
    write slot values. <name>-p is a type predicate.
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
 (defun parse-name-and-options (name-and-options)
   (destructuring-bind (name &rest options) name-and-options
-    (assert name) ; A null name doesn't seem to make sense here.
+    (aver name) ; A null name doesn't seem to make sense here.
     (let ((defstruct (make-defstruct-description name)))
       (dolist (option options)
        (cond ((consp option)
     (dolist (slot (dd-slots defstruct))
       (let ((dum (gensym))
            (name (dsd-name slot)))
-       (arglist `((,(intern (string name) "KEYWORD") ,dum)
-                  ,(dsd-default slot)))
+       (arglist `((,(keywordicate name) ,dum) ,(dsd-default slot)))
        (types (dsd-type slot))
        (vals dum)))
     (funcall creator
                     (rest args)))
         (inherits (inherits-for-structure defstruct)))
     (function-%compiler-only-defstruct defstruct inherits)))
+
+(/show0 "code/defstruct.lisp end of file")