GNU bug report logs - #38252
27.0.50; Gnus server definitions and generic function specializers

Previous Next

Package: emacs;

Reported by: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Date: Sun, 17 Nov 2019 22:32:02 UTC

Severity: normal

Found in version 27.0.50

Full log


Message #8 received at 38252 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: larsi <at> gnus.org, 38252 <at> debbugs.gnu.org
Subject: Re: bug#38252: 27.0.50; Gnus server definitions and generic
 function specializers
Date: Sun, 17 Nov 2019 21:03:00 -0500
> I'm ccing you directly because I suspect you're the only one who knows
> the answers to my questions :)

I doubt it, there's a lot of people around here more familiar with
CLOS-style programming than I.

> --8<---------------cut here---------------start------------->8---
> gnus-int.el:
> (cl-defgeneric gnus-request-list (server)
>   "Docs and stuff.")
>
> (cl-defmethod gnus-request-list ((server gnus-server-legacy))
>   (funcall (gnus-get-function server 'request-list)
> 	   (nth 1 server)))

Why not just:

    (cl-defmethod gnus-request-list (server)
      (funcall (gnus-get-function server 'request-list)
    	       (nth 1 server)))

which means "use it as a fallback".  The downside is that it will be
used for non-legacy servers if there is no specific implementation for
that server, but presumably you can detect it and signal an appropriate
error somewhere inside gnus-get-function.

> What I'm trying to do is fairly simple: if the argument is a list, and
> the head of the list is a symbol that can be assoc'd into
> `nnoo-definition-alist', and the second element is a string, then it's a
> gnus-legacy-server.

Why not just use a `cons` specializer?

IIUC all the non-legacy servers will use structs, so you don't need to
use a specializer that's so specific that it has to check "if the
argument is a list, and the head of the list is a symbol that can be
assoc'd into `nnoo-definition-alist', and the second element is
a string".


        Stefan





This bug report was last modified 5 years and 213 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.