mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-17 06:42:18 -08:00
STRUCTURE-CLASS and STRUCTURE-OBJECT are now created at boot time
This commit is contained in:
parent
6bb1155f84
commit
9db8116248
2 changed files with 21 additions and 18 deletions
|
|
@ -72,16 +72,6 @@
|
|||
;;; STRUCTURES
|
||||
;;;
|
||||
|
||||
(defclass structure-class (class)
|
||||
(slot-descriptions
|
||||
initial-offset
|
||||
defstruct-form
|
||||
constructors
|
||||
documentation
|
||||
copier
|
||||
predicate
|
||||
print-function))
|
||||
|
||||
;;; structure-classes cannot be instantiated
|
||||
(defmethod make-instance ((class structure-class) &rest initargs)
|
||||
(declare (ignore initargs))
|
||||
|
|
@ -93,14 +83,6 @@
|
|||
(unless (eq :INSTANCE (slot-definition-allocation slot))
|
||||
(error "The structure class ~S can't have shared slots" (class-name class)))))
|
||||
|
||||
;;; ----------------------------------------------------------------------
|
||||
;;; Structure-object
|
||||
;;;
|
||||
;;; Structure-object has no slots and inherits only from t:
|
||||
|
||||
(defclass structure-object (t) ()
|
||||
(:metaclass structure-class))
|
||||
|
||||
(defmethod make-load-form ((object structure-object) &optional environment)
|
||||
(make-load-form-saving-slots object :key environment))
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,21 @@
|
|||
(optimize-slot-access)
|
||||
(forward)))))
|
||||
|
||||
;;; ----------------------------------------------------------------------
|
||||
;;; STRUCTURE-CLASS
|
||||
|
||||
(eval-when (:compile-toplevel :execute)
|
||||
(defparameter +structure-class-slots+
|
||||
(append +class-slots+
|
||||
'((slot-descriptions)
|
||||
(initial-offset)
|
||||
(defstruct-form)
|
||||
(constructors)
|
||||
(documentation)
|
||||
(copier)
|
||||
(predicate)
|
||||
(print-function)))))
|
||||
|
||||
;;; ----------------------------------------------------------------------
|
||||
;;; STANDARD-GENERIC-FUNCTION
|
||||
|
||||
|
|
@ -290,5 +305,11 @@
|
|||
(standard-writer-method
|
||||
:direct-superclasses (standard-accessor-method)
|
||||
:direct-slots #2#)
|
||||
(structure-class
|
||||
:direct-superclasses (class)
|
||||
:direct-slots #.+structure-class-slots+)
|
||||
(structure-object
|
||||
:metaclass structure-class
|
||||
:direct-superclasses (t))
|
||||
)))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue