chiark / gitweb /
src/class-make-impl.lisp: Introduce property to choose initarg class.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 2 Aug 2017 09:40:14 +0000 (10:40 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 Jun 2018 18:58:40 +0000 (19:58 +0100)
This is now uniform, at least.

doc/syntax.tex
src/class-make-impl.lisp

index acf6f3f84445b27864f2b169c893d3575835db1c..0e14e17bd5dc42aa893cd3dd8ae53d9073a1aae0 100644 (file)
@@ -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.
   @<declaration-specifier>^+
   <list>$[\mbox{@<init-declarator>}]$ ";"
 \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}
index 7263e44f7fce100afe9284d2b4d161a0c2d9799f..3c5bb3579acebe6332e1c0193d5c58ae693f78b0 100644 (file)
@@ -144,9 +144,10 @@ (defmethod shared-initialize :after
 
 (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
 
 (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))))