Subject: bug#20420: 25.0.50; eieio methods with optional arguments now fail

From: Stefan Monnier <[email-masked]>
Date: Sat, 25 Apr 2015 10:41:40 -0400

>> Hmmm... I think this really only worked by accident and wasn't
>> explicitly supported by Emacs-24's doc.  And adding support for such
>> degenerate methods might not be straightforward in eieio-compat.el, so
>> I'm wondering where you've seen such use, to see how important it is to
>> provide that level of backward compatibility.
> I was using function xx that, when called with no arguments, dispatched
> methods with the same name on a local object in the current buffer.

That tells me *how* you used it, not *where*.

> As we are on this topic how about allowing for implicit dispatch on the
> arbitrary context? I mean something along the following lines:

Quoting from cl-generic.el:

   ;; TODO:
   [...]
   ;; - A way to dispatch on the context (e.g. the major-mode, some global
   ;;   variable, you name it).
   [...]
   ;;; Just for kicks: dispatch on major-mode
   ;;
   ;; Here's how you'd use it:
   ;;   (cl-defmethod foo ((x (major-mode text-mode)) y z) ...)
   ;; And then
   ;;     (foo 'major-mode toto titi)
   ;;
   ;; FIXME: Better would be to do that via dispatch on an "implicit argument".
   ;; E.g. (cl-defmethod foo (y z &context (major-mode text-mode)) ...)

IOW, patch welcome.

        Stefan