From: Mark Wooding Date: Sun, 30 Aug 2015 09:58:38 +0000 (+0100) Subject: src/class-make-proto.lisp: Choose Lisp metaclass more cleverly. X-Git-Url: https://git.distorted.org.uk/~mdw/sod/commitdiff_plain/4f5ac503eaef8d661edc5c9cafdbcbe3b9450db4 src/class-make-proto.lisp: Choose Lisp metaclass more cleverly. Use the same algorithm as is used to choose the runtime metaclass: if a property names a class explicitly then use that; otherwise, choose the most specific metaclass of any of the direct superclasses. If there are no proper superclasses then default to `sod-class' because that's what `builtin' needs. --- diff --git a/src/class-make-proto.lisp b/src/class-make-proto.lisp index c04727c..8b024bd 100644 --- a/src/class-make-proto.lisp +++ b/src/class-make-proto.lisp @@ -45,8 +45,14 @@ (with-default-error-location (location) (let* ((pset (property-set pset)) - (class (make-instance (get-property pset :lisp-metaclass :symbol - 'sod-class) + (best-class (or (get-property pset :lisp-metaclass :symbol nil) + (if superclasses + (maximum (mapcar #'class-of superclasses) + #'subtypep + (format nil "Lisp metaclass for ~A" + name)) + 'sod-class))) + (class (make-instance best-class :name name :superclasses superclasses :location (file-location location)