\begin{describe*}
{\dhead{gf}
{make-sod-instance-initializer
- \=@<class> @<nick> @<name> @<value> @<pset> \&key :location
+ \=@<class> @<nick> @<name> @<value> @<pset> \\
+ \>\&key :inhibit-initargs :location
\nlret @<init>}
\dhead{gf}
{make-sod-class-initializer
;;; Slot initializers.
(defmethod make-sod-instance-initializer
- ((class sod-class) nick name value pset &key location)
+ ((class sod-class) nick name value pset &key location inhibit-initargs)
(with-default-error-location (location)
(let* ((slot (find-instance-slot-by-name class nick name))
(initarg-name (get-property pset :initarg :id))
(with-slots (instance-initializers) class
(unless (or initarg-name initializer)
(error "Slot initializer declaration with no effect"))
- (when initarg-name
+ (when (and initarg-name (not inhibit-initargs))
(make-sod-slot-initarg-using-slot class initarg-name slot pset
:location location))
(when initializer
(export 'make-sod-instance-initializer)
(defgeneric make-sod-instance-initializer
- (class nick name value pset &key location)
+ (class nick name value pset &key location inhibit-initargs)
(:documentation
"Construct and attach an instance slot initializer, to CLASS.
construction process. The default method looks up the slot using
`find-instance-slot-by-name', calls `make-sod-initializer-using-slot' to
actually make the initializer object, and adds it to the appropriate list
- in CLASS."))
+ in CLASS.
+
+ Usually, if an `initarg' property is set on PSET, then a slot initarg is
+ created and attached to the slot; this can be prevented by setting
+ INHIBIT-INITARGS non-nil. This is needed when creating a slot and
+ initializer from the same property set, in order to prevent creation of a
+ duplicate initarg."))
(export 'make-sod-class-initializer)
(defgeneric make-sod-class-initializer