- (let* ((include (or (and supers
- (fix-super (car supers)))
- (and (not (eq name 'structure-object))
- *the-class-structure-object*)))
- (defstruct-form (make-structure-class-defstruct-form
- name slots include)))
- `(progn
- (eval-when (:compile-toplevel :load-toplevel :execute)
- ,defstruct-form) ; really compile the defstruct-form
- (eval-when (:compile-toplevel :load-toplevel :execute)
- ,defclass-form)))
- `(progn
- ;; By telling the type system at compile time about
- ;; the existence of a class named NAME, we can avoid
- ;; various bogus warnings about "type isn't defined yet".
- ,(when (and
- ;; But it's not so important to get rid of
- ;; "not defined yet" warnings during
- ;; bootstrapping, and machinery like
- ;; INFORM-TYPE-SYSTEM-ABOUT-STD-CLASS
- ;; mightn't be defined yet. So punt then.
- (eq *boot-state* 'complete)
- ;; And although we know enough about
- ;; STANDARD-CLASS, and ANSI imposes enough
- ;; restrictions on the user overloading its
- ;; methods, that (1) we can shortcut the
- ;; method dispatch and do an ordinary
- ;; function call, and (2) be sure we're getting
- ;; it right even when we do it at compile
- ;; time; we don't in general know how to do
- ;; that for other classes. So punt then too.
- (eq metaclass 'standard-class))
- `(eval-when (:compile-toplevel)
- ;; we only need :COMPILE-TOPLEVEL here, because this
- ;; should happen in the compile-time environment
- ;; only.
- ;; Later, INFORM-TYPE-SYSTEM-ABOUT-STD-CLASS is
- ;; called by way of LOAD-DEFCLASS (calling
- ;; ENSURE-CLASS-USING-CLASS) to establish the 'real'
- ;; type predicate.
- (inform-type-system-about-std-class ',name)))
- ,defclass-form))))))))
+ (progn
+ ;; FIXME: (YUK!) Why do we do this? Because in order
+ ;; to make the defstruct form, we need to know what
+ ;; the accessors for the slots are, so we need
+ ;; already to have hooked into the CLOS machinery.
+ ;;
+ ;; There may be a better way to do this: it would
+ ;; involve knowing enough about PCL to ask "what
+ ;; will my slot names and accessors be"; failing
+ ;; this, we currently just evaluate the whole
+ ;; kaboodle, and then use CLASS-DIRECT-SLOTS. --
+ ;; CSR, 2002-06-07
+ (eval defclass-form)
+ (let* ((include (or (and supers
+ (fix-super (car supers)))
+ (and (not (eq name 'structure-object))
+ *the-class-structure-object*)))
+ (defstruct-form (make-structure-class-defstruct-form
+ name (class-direct-slots (find-class name)) include)))
+ `(progn
+ (eval-when (:compile-toplevel :load-toplevel :execute)
+ ,defstruct-form) ; really compile the defstruct-form
+ (eval-when (:compile-toplevel :load-toplevel :execute)
+ ,defclass-form))))
+ `(progn
+ ;; By telling the type system at compile time about
+ ;; the existence of a class named NAME, we can avoid
+ ;; various bogus warnings about "type isn't defined yet"
+ ;; for code elsewhere in the same file which uses
+ ;; the name of the type.
+ ;;
+ ;; We only need to do this at compile time, because
+ ;; at load and execute time we write the actual
+ ;; full-blown class, so the "a class of this name is
+ ;; coming" note we write here would be irrelevant.
+ (eval-when (:compile-toplevel)
+ (preinform-compiler-about-class-type ',name))
+ ,defclass-form))))))))