unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: Generic functions: Specializers like `or' or `memq'?
Date: Wed, 03 Nov 2021 18:21:43 +0000	[thread overview]
Message-ID: <87y265aymg.fsf@posteo.net> (raw)
In-Reply-To: <87r1bxcg6g.fsf@web.de> (Michael Heerdegen's message of "Wed, 03 Nov 2021 18:17:11 +0100")

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



  reply	other threads:[~2021-11-03 18:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 17:17 Generic functions: Specializers like `or' or `memq'? Michael Heerdegen
2021-11-03 18:21 ` Philip Kaludercic [this message]
2021-11-03 21:10   ` Michael Heerdegen
2021-11-03 21:32     ` Eric Abrahamsen
2021-11-03 23:19       ` Michael Heerdegen
2021-11-03 23:38         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-11-04  0:26           ` Michael Heerdegen
2021-11-04  1:31       ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-04  2:34         ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-04  4:01           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-11-06 22:32         ` Michael Heerdegen
2021-11-06 23:36           ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-07  1:48             ` Michael Heerdegen
2021-11-21 19:43               ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-23  8:16                 ` Michael Heerdegen
  -- strict thread matches above, loose matches on Subject: below --
2021-11-04 17:31 Eric Abrahamsen
2021-11-05 21:17 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-05 21:36   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-11-06 23:29     ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-06 23:52       ` Emanuel Berg via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y265aymg.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).