]> git.eshelyaron.com Git - emacs.git/commit
Move EIEIO's C3 linearization code to `subr.el`
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 7 Nov 2023 23:57:03 +0000 (18:57 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 11 Nov 2023 16:51:59 +0000 (11:51 -0500)
commitfbb897b7af53cdb43e18322c5cdfbfef7cdda1ee
treeff0f112ad184b3ac86e000e4d3c5badac851622d
parent8323394bc801e01dedd95e0ff8d573dd1f5e34ba
Move EIEIO's C3 linearization code to `subr.el`

The code was used to linearize the EIEIO class hierarchy, since
it results in saner results than things like BFS or DFS.
By moving it to `subr.el` we get to benefit from that same
advantage both in `cl--class-allparents` and
in `derived-mode-all-parents`.

* lisp/subr.el (merge-ordered-lists): New function.
(derived-mode-all-parents): Use it to improve parent ordering.

* lisp/emacs-lisp/eieio-core.el (eieio--c3-candidate)
(eieio--c3-merge-lists): Delete functions, replaced by
`merge-ordered-lists`.
(eieio--class-precedence-c3): Use `merge-ordered-lists`.

* lisp/emacs-lisp/cl-preloaded.el (cl--class-allparents):
Use `merge-ordered-lists` to improve parent ordering.
* lisp/emacs-lisp/cl-macs.el (cl--struct-all-parents): Delete function.
(cl--pcase-mutually-exclusive-p): Use `cl--class-allparents` instead.
lisp/emacs-lisp/cl-macs.el
lisp/emacs-lisp/cl-preloaded.el
lisp/emacs-lisp/eieio-core.el
lisp/simple.el
lisp/subr.el