diff options
| author | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-01-18 12:24:43 -0500 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-01-18 12:24:43 -0500 |
| commit | 2a61bd0096db23123734db439051c859e42b9606 (patch) | |
| tree | 95bf8383ee904cf723e57d1560f86fc551fb139b /lisp/emacs-lisp/eieio.el | |
| parent | 8ab85ee7ce9ad101583620e7ba3bee39cf3491ae (diff) | |
| download | emacs-2a61bd0096db23123734db439051c859e42b9606.tar.gz | |
EIEIO&cl-generic: Add obsolescence warnings and fix corner case
* lisp/emacs-lisp/cl-generic.el (cl-generic-define-method): Correctly handle
introduction of a new dispatch argument.
(cl--generic-cache-miss): Handle dispatch on an argument which was not
considered as dispatchable for this method.
(cl-defmethod): Warn when adding a method to an obsolete generic function.
(cl--generic-lambda): Make sure it works if cl-lib is not yet loaded.
* lisp/emacs-lisp/eieio-generic.el (eieio--defgeneric-init-form):
Use autoloadp.
* lisp/emacs-lisp/eieio.el (defclass): Add obsolescence warning for the
`newname' argument.
* test/automated/cl-generic-tests.el (cl-generic-test-10-weird): New test.
Rename other tests to preserve ordering.
Diffstat (limited to 'lisp/emacs-lisp/eieio.el')
| -rw-r--r-- | lisp/emacs-lisp/eieio.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index c5597b83170..0c85d90151a 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -276,6 +276,17 @@ and reference them using the function `class-option'." `(defun ,name (&rest slots) ,(format "Create a new object with name NAME of class type %S." name) + (declare (compiler-macro + (lambda (whole) + (if (not (stringp (car slots))) + whole + (macroexp--warn-and-return + (format "Obsolete name arg %S to constructor %S" + (car slots) (car whole)) + ;; Keep the name arg, for backward compatibility, + ;; but hide it so we don't trigger indefinitely. + `(,(car whole) (identity ,(car slots)) + ,@(cdr slots))))))) (apply #'eieio-constructor ',name slots)))))) |
