chiark / gitweb /
src/: Rename the various `:lisp-class' properties.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 29 Aug 2015 14:11:55 +0000 (15:11 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 30 Aug 2015 17:11:38 +0000 (18:11 +0100)
Instead, there's now a separate property for each kind of metaobject.
The reason is that some declarations can produce two metaobjects, e.g.,
a message declaration might also include a direct method, and we can't
possibly use the same metaobject class for both.  To resolve this, we
use different properties to name the different metaobject classes.

  * For classes, we use `:lisp-metaclass' (to distinguish from a runtime
    metaclass).

  * For messages, `:message-class'.

  * For methods, `:method-class'.

  * For slots, `:slot-class'.

  * For slot initializers, `:initializer-class'.

  * For modules, `:module-class'.

src/builtin.lisp
src/class-make-impl.lisp
src/class-make-proto.lisp
src/module-impl.lisp
src/module-proto.lisp

index c38d92cd4c72b15b0a45c4126f43280744e7fba8..8b4407b268ebfc84ba5520af260eadec9a955631 100644 (file)
@@ -61,7 +61,7 @@ (defmacro define-class-slot
       ',name
       (lambda (,classvar)
        (make-sod-slot ,classvar ,name (c-type ,type)
       ',name
       (lambda (,classvar)
        (make-sod-slot ,classvar ,name (c-type ,type)
-                      (make-property-set :lisp-class 'sod-class-slot
+                      (make-property-set :slot-class 'sod-class-slot
                                          :initializer-function
                                          (lambda (,class)
                                            ,init)
                                          :initializer-function
                                          (lambda (,class)
                                            ,init)
index 09ce441c9e307b87ff783a79353dae5cba918f38..1daab398cb492c56195e2faa66463ea40d42138e 100644 (file)
@@ -79,7 +79,7 @@   (default-slot-from-property (class 'chain-link slot-names)
 (defmethod make-sod-slot
     ((class sod-class) name type pset &optional location)
   (with-default-error-location (location)
 (defmethod make-sod-slot
     ((class sod-class) name type pset &optional location)
   (with-default-error-location (location)
-    (let ((slot (make-instance (get-property pset :lisp-class :symbol
+    (let ((slot (make-instance (get-property pset :slot-class :symbol
                                             'sod-slot)
                               :class class
                               :name name
                                             'sod-slot)
                               :class class
                               :name name
@@ -129,7 +129,7 @@ (defmethod make-sod-class-initializer
 (defmethod make-sod-initializer-using-slot
     ((class sod-class) (slot sod-slot)
      init-class value-kind value-form pset location)
 (defmethod make-sod-initializer-using-slot
     ((class sod-class) (slot sod-slot)
      init-class value-kind value-form pset location)
-  (make-instance (get-property pset :lisp-class :symbol init-class)
+  (make-instance (get-property pset :initializer-class :symbol init-class)
                 :class class
                 :slot slot
                 :value-kind value-kind
                 :class class
                 :slot slot
                 :value-kind value-kind
@@ -152,7 +152,7 @@ (defmethod shared-initialize :after
 (defmethod make-sod-message
     ((class sod-class) name type pset &optional location)
   (with-default-error-location (location)
 (defmethod make-sod-message
     ((class sod-class) name type pset &optional location)
   (with-default-error-location (location)
-    (let ((message (make-instance (get-property pset :lisp-class :symbol
+    (let ((message (make-instance (get-property pset :message-class :symbol
                                                'standard-message)
                                  :class class
                                  :name name
                                                'standard-message)
                                  :class class
                                  :name name
@@ -189,7 +189,7 @@ (defmethod make-sod-method
 
 (defmethod make-sod-method-using-message
     ((message sod-message) (class sod-class) type body pset location)
 
 (defmethod make-sod-method-using-message
     ((message sod-message) (class sod-class) type body pset location)
-  (make-instance (or (get-property pset :lisp-class :symbol)
+  (make-instance (or (get-property pset :method-class :symbol)
                     (sod-message-method-class message class pset))
                 :message message
                 :class class
                     (sod-message-method-class message class pset))
                 :message message
                 :class class
index 2b4463a3c04a5bbb88a82c6915c1b5e6f6dc0de8..01e18eb022deae4cd11a7e60d1e41b4532e5a3e8 100644 (file)
@@ -33,8 +33,8 @@ (defun make-sod-class (name superclasses pset &optional location)
   "Construct and return a new SOD class with the given NAME and SUPERCLASSES.
 
    This is the main constructor function for classes.  The protocol works as
   "Construct and return a new SOD class with the given NAME and SUPERCLASSES.
 
    This is the main constructor function for classes.  The protocol works as
-   follows.  The `:lisp-class' property in PSET is checked: if it exists, it
-   must be a symbol naming a (CLOS) class, which is used in place of
+   follows.  The `:lisp-metaclass' property in PSET is checked: if it exists,
+   it must be a symbol naming a (CLOS) class, which is used in place of
    `sod-class'.  All of the arguments are then passed to `make-instance';
    further behaviour is left to the standard CLOS instance construction
    protocol; for example, `sod-class' defines an `:after'-method on
    `sod-class'.  All of the arguments are then passed to `make-instance';
    further behaviour is left to the standard CLOS instance construction
    protocol; for example, `sod-class' defines an `:after'-method on
@@ -45,7 +45,7 @@ (defun make-sod-class (name superclasses pset &optional location)
 
   (with-default-error-location (location)
     (let* ((pset (property-set pset))
 
   (with-default-error-location (location)
     (let* ((pset (property-set pset))
-          (class (make-instance (get-property pset :lisp-class :symbol
+          (class (make-instance (get-property pset :lisp-metaclass :symbol
                                               'sod-class)
                                 :name name
                                 :superclasses superclasses
                                               'sod-class)
                                 :name name
                                 :superclasses superclasses
@@ -71,7 +71,7 @@ (defgeneric make-sod-slot (class name type pset &optional location)
 
    This is the main constructor function for slots.  This is a generic
    function primarily so that the CLASS can intervene in the construction
 
    This is the main constructor function for slots.  This is a generic
    function primarily so that the CLASS can intervene in the construction
-   process.  The default method uses the `:lisp-class' property (defaulting
+   process.  The default method uses the `:slot-class' property (defaulting
    to `sod-slot') to choose a (CLOS) class to instantiate.  The slot is then
    constructed by `make-instance' passing the arguments as initargs; further
    behaviour is left to the standard CLOS instance construction protocol; for
    to `sod-slot') to choose a (CLOS) class to instantiate.  The slot is then
    constructed by `make-instance' passing the arguments as initargs; further
    behaviour is left to the standard CLOS instance construction protocol; for
@@ -111,11 +111,11 @@ (defgeneric make-sod-initializer-using-slot
 
    This generic function does the common work for constructing instance and
    class initializers.  It can usefully be specialized according to both the
 
    This generic function does the common work for constructing instance and
    class initializers.  It can usefully be specialized according to both the
-   class and slot types.  The default method uses the `:lisp-class' property
-   (defaulting to INIT-CLASS) to choose a (CLOS) class to instantiate.  The
-   slot is then constructed by `make-instance' passing the arguments as
-   initargs; further behaviour is left to the standard CLOS instance
-   construction protocol; for example, `sod-initializer' defines an
+   class and slot types.  The default method uses the `:initializer-class'
+   property (defaulting to INIT-CLASS) to choose a (CLOS) class to
+   instantiate.  The slot is then constructed by `make-instance' passing the
+   arguments as initargs; further behaviour is left to the standard CLOS
+   instance construction protocol; for example, `sod-initializer' defines an
    `:after'-method on `shared-initialize'.
 
    Diagnosing unused properties is left for the caller (usually
    `:after'-method on `shared-initialize'.
 
    Diagnosing unused properties is left for the caller (usually
@@ -136,12 +136,12 @@ (defgeneric make-sod-message (class name type pset &optional location)
 
    This is the main constructor function for messages.  This is a generic
    function primarily so that the CLASS can intervene in the construction
 
    This is the main constructor function for messages.  This is a generic
    function primarily so that the CLASS can intervene in the construction
-   process.  The default method uses the `:lisp-class' property (defaulting
-   to `sod-message') to choose a (CLOS) class to instantiate.  The message is
-   then constructed by `make-instance' passing the arguments as initargs;
-   further behaviour is left to the standard CLOS instance construction
-   protocol; for example, `sod-message' defines an `:after'-method on
-   `shared-initialize'."))
+   process.  The default method uses the `:message-class' property
+   (defaulting to `sod-message') to choose a (CLOS) class to instantiate.
+   The message is then constructed by `make-instance' passing the arguments
+   as initargs; further behaviour is left to the standard CLOS instance
+   construction protocol; for example, `sod-message' defines an
+   `:after'-method on `shared-initialize'."))
 
 (export 'make-sod-method)
 (defgeneric make-sod-method
 
 (export 'make-sod-method)
 (defgeneric make-sod-method
@@ -167,7 +167,7 @@ (defgeneric make-sod-method-using-message
 
    This is a generic function so that it can be specialized according to both
    a class and -- more particularly -- a message.  The default method uses
 
    This is a generic function so that it can be specialized according to both
    a class and -- more particularly -- a message.  The default method uses
-   the `:lisp-class' property (defaulting to the result of calling
+   the `:method-class' property (defaulting to the result of calling
    `sod-message-method-class') to choose a (CLOS) class to instantiate.  The
    method is then constructed by `make-instance' passing the arguments as
    initargs; further behaviour is left to the standard CLOS instance
    `sod-message-method-class') to choose a (CLOS) class to instantiate.  The
    method is then constructed by `make-instance' passing the arguments as
    initargs; further behaviour is left to the standard CLOS instance
@@ -187,9 +187,9 @@ (defgeneric sod-message-method-class (message class pset)
    "Return the preferred class for methods on MESSAGE.
 
    The message can inspect the PSET to decide on a particular message.  A
    "Return the preferred class for methods on MESSAGE.
 
    The message can inspect the PSET to decide on a particular message.  A
-   `:lisp-class' property will usually override this decision: it's then the
-   programmer's responsibility to ensure that the selected method class is
-   appropriate."))
+   `:method-class' property will usually override this decision: it's then
+   the programmer's responsibility to ensure that the selected method class
+   is appropriate."))
 
 (export 'check-message-type)
 (defgeneric check-message-type (message type)
 
 (export 'check-message-type)
 (defgeneric check-message-type (message type)
index 89e1ffb61716d4d8dcf7aa037210a372f1c77738..9e74b2703f7cbbe908493485cb3f5d92249c065f 100644 (file)
@@ -45,7 +45,7 @@ (defmethod shared-initialize :after ((module module) slot-names &key pset)
 
 (defmethod finalize-module ((module module))
   (let* ((pset (module-pset module))
 
 (defmethod finalize-module ((module module))
   (let* ((pset (module-pset module))
-        (class (get-property pset :lisp-class :symbol 'module)))
+        (class (get-property pset :module-class :symbol 'module)))
 
     ;; Always call `change-class', even if it's the same one; this will
     ;; exercise the property-set fiddling in `shared-initialize' and we can
 
     ;; Always call `change-class', even if it's the same one; this will
     ;; exercise the property-set fiddling in `shared-initialize' and we can
index 4152329de841c6f22ca37f5bbabf4f473d538b0c..acb1926cf10b428f47ecefcc7621a9642206e121 100644 (file)
@@ -101,7 +101,7 @@ (defparameter *module* nil
 
    During module construction, this is always an instance of `module'.  Once
    we've finished constructing it, we'll call `change-class' to turn it into
 
    During module construction, this is always an instance of `module'.  Once
    we've finished constructing it, we'll call `change-class' to turn it into
-   an instance of whatever type is requested in the module's `:lisp-class'
+   an instance of whatever type is requested in the module's `:module-class'
    property.")
 
 (export 'module-import)
    property.")
 
 (export 'module-import)
@@ -135,9 +135,9 @@ (defgeneric finalize-module (module)
    This isn't necessary if you made the module by hand.  If you've
    constructed it incrementally, then it might be a good plan.  In
    particular, it will change the class (using `change-class') of the module
    This isn't necessary if you made the module by hand.  If you've
    constructed it incrementally, then it might be a good plan.  In
    particular, it will change the class (using `change-class') of the module
-   according to the class choice set in the module's `:lisp-class' property.
-   This has the side effects of calling `shared-initialize', setting the
-   module's state to `t', and checking for unrecognized
+   according to the class choice set in the module's `:module-class'
+   property.  This has the side effects of calling `shared-initialize',
+   setting the module's state to `t', and checking for unrecognized
    properties.  (Therefore subclasses should add a method to
    `shared-initialize' taking care of looking at interesting properties, just
    to make sure they're ticked off.)"))
    properties.  (Therefore subclasses should add a method to
    `shared-initialize' taking care of looking at interesting properties, just
    to make sure they're ticked off.)"))