diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-01-20 15:40:29 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-01-20 15:40:29 -0500 |
commit | 3a8312d00e59b50e76121cd512177e999c18b06d (patch) | |
tree | f34f91c2bfc196318febd809c9ec8304aae1fbc9 /lisp/emacs-lisp/cl-generic.el | |
parent | f948b5d9ff60b40e361b2b9428eda2ad4c0ad105 (diff) | |
download | emacs-3a8312d00e59b50e76121cd512177e999c18b06d.tar.gz emacs-3a8312d00e59b50e76121cd512177e999c18b06d.tar.bz2 emacs-3a8312d00e59b50e76121cd512177e999c18b06d.zip |
lisp/emacs-lisp/eieio*.el: Rewrite our generics on top of cl-generic
* lisp/emacs-lisp/eieio-generic.el: Remove.
(defgeneric, defmethod): Move to eieio-compat.el. Mark obsolete.
* lisp/emacs-lisp/eieio-compat.el: New file.
* lisp/emacs-lisp/eieio.el: Don't require eieio-generic any more.
* lisp/emacs-lisp/eieio-core.el (eieio--slot-originating-class-p):
Remove unused function.
(eieio-defclass): Move to eieio-compat.el.
* lisp/emacs-lisp/macroexp.el (macroexp-macroexpand): New function.
(macroexp--expand-all): Use it.
* lisp/emacs-lisp/bytecomp.el (byte-compile-recurse-toplevel): Here too.
Diffstat (limited to 'lisp/emacs-lisp/cl-generic.el')
-rw-r--r-- | lisp/emacs-lisp/cl-generic.el | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 544f1fa140f..3bbddfc45a1 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -37,9 +37,26 @@ ;; Added elements: ;; - We support aliases to generic functions. ;; - The kind of thing on which to dispatch can be extended. -;; There is support in this file for (eql <val>) dispatch as well as dispatch -;; on the type of CL structs, and eieio-core.el adds support for EIEIO -;; defclass objects. +;; There is support in this file for dispatch on: +;; - (eql <val>) +;; - plain old types +;; - type of CL structs +;; eieio-core adds dispatch on: +;; - class of eieio objects +;; - actual class argument, using the syntax (subclass <class>). + +;; Efficiency considerations: overall, I've made an effort to make this fairly +;; efficient for the expected case (e.g. no constant redefinition of methods). +;; - Generic functions which do not dispatch on any argument are implemented +;; optimally (just as efficient as plain old functions). +;; - Generic functions which only dispatch on one argument are fairly efficient +;; (not a lot of room for improvement, I think). +;; - Multiple dispatch is implemented rather naively. There's an extra `apply' +;; function call for every dispatch; we don't optimize each dispatch +;; based on the set of candidate methods remaining; we don't optimize the +;; order in which we performs the dispatches either; If/when this +;; becomes a problem, we can try and optimize it. +;; - call-next-method could be made more efficient, but isn't too terrible. ;;; Code: |