[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20420: 25.0.50; eieio methods with optional arguments now fail
From: |
Vitalie Spinu |
Subject: |
bug#20420: 25.0.50; eieio methods with optional arguments now fail |
Date: |
Sun, 26 Apr 2015 14:00:39 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
>>> Stefan Monnier on Sun, 26 Apr 2015 00:02:51 -0400 wrote:
>>> That tells me *how* you used it, not *where*.
>> I was using it in polymode package for a generic indentation
>> functionality:
>> https://github.com/vspinu/polymode/blob/master/polymode-methods.el#L530
> [ After figuring out that the code now doesn't do that any more and
> seeing the old code which does do the "nasty" empty-args defmethod. ]
Sorry about that. I wasn't expected you will be interested in so much
detail. I would have been more elaborate.
>> Aha. Cool! I will have a look. Is there a more elaborate documentation
>> somewhere?
> No, it's more a wishlist item: add support for formal pseudo-arguments
> of the form "&context (<exp> <specializer>)".
>> Particularly I don't see "specializer" and "generalizer"
>> being properly defined anywhere.
> "Specializer" is used commonly in CLOS to refer to the "thing" that can
> be either a class type or (eql <value>). "Generalizer" is not standard
> and refers to a thing that takes a value (the actual argument) and finds
> its corresponding specializers (i.e. its type(s)). I took the term from
> an article that extended CLOS method-matching. cl-generic.el does not
> directly implement that article, but it's fairly similar.
This sounds like a more involved version of what Clojure does with
multimethods (also implemented in emacs multi.el package [1])
When Clojure's generic is defined you supply a dispatch function that
takes all actual arguments and returns an object (commonly a
symbol). The returned object is then used directly for dispatch. If I
understand correctly the dispatch function is like your generalizer.
Vitalie
[1] https://github.com/kurisuwhyte/emacs-multi
Better documented at https://github.com/vspinu/emacs-multi