From: Mark Wooding Date: Sat, 7 Jul 2018 13:41:55 +0000 (+0100) Subject: src/class-finalize-impl.lisp (clos-tiebreaker): Search from the right end. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/commitdiff_plain/b045196ca0fcb1d72d2d6b1c4eabcc76df13e034?ds=inline src/class-finalize-impl.lisp (clos-tiebreaker): Search from the right end. The docstring clearly says that we take the candidate whose direct subclass is rightmost in the SO-FAR list, but the code searches SO-FAR from the left and takes the first match. As far as I can make out, this has always been wrong: the earliest version of `merge-lists' builds the output list in order, and the earliest version of `clos-tiebreaker' searched from the left anyway. Just reverse the list before scanning. --- diff --git a/src/class-finalize-impl.lisp b/src/class-finalize-impl.lisp index 6401318..b92b604 100644 --- a/src/class-finalize-impl.lisp +++ b/src/class-finalize-impl.lisp @@ -123,7 +123,7 @@ (defun clos-tiebreaker (candidates so-far) direct subclass then that subclass's direct superclasses list must order them relative to each other." - (dolist (class so-far) + (dolist (class (reverse so-far)) (dolist (candidate candidates) (when (member candidate (sod-class-direct-superclasses class)) (return-from clos-tiebreaker candidate))))