[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generic functions: Specializers like `or' or `memq'?
From: |
Philip Kaludercic |
Subject: |
Re: Generic functions: Specializers like `or' or `memq'? |
Date: |
Wed, 03 Nov 2021 18:21:43 +0000 |
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Hello,
>
> I come back to this question again and again, so it's time to just ask:
>
> Often I want to use a certain method implementation for several very
> similar cases and want to avoid code duplication, but I don't know how
> to express this using the existing method specializers.
>
> For example, I want the `head' spec to match one of several symbols who
> are synonymous. Or instead of (eql SYM) I would rather want
> (memq (SYMS...)). Or I want to combine several SPECS using `or' because
> the implementation is the same.
>
> Am I'm missing something or - this is not possible currently, right?
> Would it be possible to implement such stuff then?
I haven't tried it myself, but it seems like you would have to use
cl-generic-generalizers (see cl-generic.el) to do so.
--
Philip Kaludercic