From 4f5ac503eaef8d661edc5c9cafdbcbe3b9450db4 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 30 Aug 2015 10:58:38 +0100 Subject: [PATCH] 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. --- src/class-make-proto.lisp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) -- 2.11.0