From 0e5c0b9edba8966aba72acb2b101b7a13d80f45a Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 2 Aug 2017 10:40:14 +0100 Subject: [PATCH] src/class-make-impl.lisp: Introduce property to choose initarg class. This is now uniform, at least. --- doc/syntax.tex | 8 +++++++- src/class-make-impl.lisp | 9 +++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/syntax.tex b/doc/syntax.tex index acf6f3f..0e14e17 100644 --- a/doc/syntax.tex +++ b/doc/syntax.tex @@ -683,6 +683,8 @@ Properties: \xref{sec:concepts.lifecycle.birth} for the details. An initializer item must have either an @|initarg| property, or an initializer expression, or both. +\item[@"initarg_class"] A symbol naming the Lisp class to use to represent + the initarg. Only permitted if @"initarg" is also set. \end{description} Each class may define at most one initializer item with an explicit @@ -695,7 +697,11 @@ initializer expression for a given slot. @^+ $[\mbox{@}]$ ";" \end{grammar} -Properties: none. +Properties: +\begin{description} +\item[@"initarg_class"] A symbol naming the Lisp class to use to represent + the initarg. +\end{description} \subsubsection{Fragment items} \begin{grammar} diff --git a/src/class-make-impl.lisp b/src/class-make-impl.lisp index 7263e44..3c5bb35 100644 --- a/src/class-make-impl.lisp +++ b/src/class-make-impl.lisp @@ -144,9 +144,10 @@ (defmethod make-sod-user-initarg ((class sod-class) name type pset &optional default location) - (declare (ignore pset)) (with-slots (initargs) class - (push (make-instance 'sod-user-initarg :location (file-location location) + (push (make-instance (get-property pset :initarg-class :symbol + 'sod-user-initarg) + :location (file-location location) :class class :name name :type type :default default) initargs))) @@ -157,10 +158,10 @@ (defmethod make-sod-slot-initarg-using-slot ((class sod-class) name (slot sod-slot) pset &optional location) - (declare (ignore pset)) (with-slots (initargs) class (with-slots ((type %type)) slot - (push (make-instance 'sod-slot-initarg + (push (make-instance (get-property pset :initarg-class :symbol + 'sod-slot-initarg) :location (file-location location) :class class :name name :type type :slot slot) initargs)))) -- 2.11.0