]> git.eshelyaron.com Git - emacs.git/commit
OClosure: Add support for defmethod dispatch
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 1 Apr 2022 12:54:55 +0000 (08:54 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 1 Apr 2022 12:54:55 +0000 (08:54 -0400)
commitff067408e460c02e69c5b7fd06a03c9b12a5744b
tree8df8cebc6c4d77ed6899ba05b88e3816c45fff12
parent611179d000cd5cf8e8955e3b3c205692a3e91225
OClosure: Add support for defmethod dispatch

* lisp/emacs-lisp/oclosure.el (oclosure--class): Add slot `allparents`.
(oclosure--class-make): Add corresponding arg `allparents`.
(oclosure, oclosure--build-class): Pass the new arg to the constructor.
(oclosure--define): Make the predicate function understand subtyping.

* lisp/emacs-lisp/cl-preloaded.el (cl--class-allparents): Move from
`cl-generic.el`.

* lisp/emacs-lisp/cl-generic.el (cl--generic-class-parents): Move to
`cl-preloaded.el` and rename to `cl--class-allparents`.
Adjust all callers.
(cl--generic-oclosure-tag, cl-generic--oclosure-specializers): New functions.
(cl-generic-generalizers) <oclosure-struct>: New generalizer.

* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test-gen):
New generic function.
(oclosure-test): Add test for dispatch on oclosure types.
lisp/emacs-lisp/cl-generic.el
lisp/emacs-lisp/cl-preloaded.el
lisp/emacs-lisp/oclosure.el
test/lisp/emacs-lisp/oclosure-tests.el