X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/284f1fa2ace3e276052ff1bd7d66442500e693da..12949379840101e2d65883f29c5e8f0f6de49e9c:/src/class-layout-proto.lisp diff --git a/src/class-layout-proto.lisp b/src/class-layout-proto.lisp index d34bf8b..5c755a3 100644 --- a/src/class-layout-proto.lisp +++ b/src/class-layout-proto.lisp @@ -34,7 +34,9 @@ ((%class :initarg :class :type sod-class :reader effective-slot-class) (slot :initarg :slot :type sod-slot :reader effective-slot-direct-slot) (initializer :initarg :initializer :type (or sod-initializer null) - :reader effective-slot-initializer)) + :reader effective-slot-initializer) + (initargs :initarg :initargs :initform nil + :type list :reader effective-slot-initargs)) (:documentation "Describes a slot and how it's meant to be initialized. @@ -50,6 +52,14 @@ (:documentation "Return the most specific initializer for SLOT, starting from CLASS.")) +(export 'find-slot-initargs) +(defgeneric find-slot-initargs (class slot) + (:documentation + "Return as a list all of the initargs defined on CLASS to initialize SLOT. + + The list is returned with initargs defined on more specific classes + first.")) + (export 'compute-effective-slot) (defgeneric compute-effective-slot (class slot) (:documentation @@ -58,6 +68,19 @@ SLOT is a direct slot defined on CLASS or one of its superclasses. (Metaclass initializers are handled using a different mechanism.)")) +(export 'find-class-initializer) +(defgeneric find-class-initializer (slot class) + (:documentation + "Return an initializer value (any printable value) for a class slot SLOT. + + The initializer might come either from the SLOT's defining class (which it + already knows), or from the instance CLASS, of which the defining class is + be (a superclass of) the metaclass. + + This is used as part of `has-class-initializer-p' and the default output + hook for `effective-slot': if you override both of those then you don't + need to override this too.")) + ;;;-------------------------------------------------------------------------- ;;; Instance layout. @@ -256,6 +279,7 @@ object's metadata; but that would either require a search or we'd have to be able work out the target chain's index in the table.")) +(export 'make-chain-offset) (defgeneric make-chain-offset (class chain-head target-head) (:documentation "Return the offset from CHAIN-HEAD to TARGET-HEAD."))