From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#38252: 27.0.50; Gnus server definitions and generic function specializers Date: Sun, 17 Nov 2019 19:18:30 -0800 Message-ID: <87imnhan3t.fsf@ericabrahamsen.net> References: <877e3yb0em.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="244899"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: larsi@gnus.org, 38252@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 18 04:19:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iWXZO-0011bI-2L for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 04:19:18 +0100 Original-Received: from localhost ([::1]:57718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWXZM-0004EY-Uu for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 22:19:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42122) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWXZB-0004DB-OC for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 22:19:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWXZ9-0002Fu-Bx for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 22:19:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34174) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWXZ8-0002FS-GX for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 22:19:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWXZ8-0004Mw-A6 for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 22:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Nov 2019 03:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38252 X-GNU-PR-Package: emacs Original-Received: via spool by 38252-submit@debbugs.gnu.org id=B38252.157404712016765 (code B ref 38252); Mon, 18 Nov 2019 03:19:02 +0000 Original-Received: (at 38252) by debbugs.gnu.org; 18 Nov 2019 03:18:40 +0000 Original-Received: from localhost ([127.0.0.1]:42995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWXYl-0004MK-Vx for submit@debbugs.gnu.org; Sun, 17 Nov 2019 22:18:40 -0500 Original-Received: from ericabrahamsen.net ([52.70.2.18]:48192 helo=mail.ericabrahamsen.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWXYk-0004M8-7H for 38252@debbugs.gnu.org; Sun, 17 Nov 2019 22:18:38 -0500 Original-Received: from localhost (c-73-254-86-141.hsd1.wa.comcast.net [73.254.86.141]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 3729FFA01D; Mon, 18 Nov 2019 03:18:32 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Sun, 17 Nov 2019 21:03:00 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:171882 Archived-At: On 11/17/19 21:03 PM, Stefan Monnier wrote: >> 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". Okay, perhaps I was overthinking this. I don't want to assume that the fallback is an old-style server (we might want to use the fallback for other purposes), but you're right that 'cons is pretty much sufficient. If anyone feeds a cons value into a Gnus server interface function that *isn't* a server definition, that falls into "serves you right" territory. But just so I don't feel like I wasted my afternoon: how *would* one write the generalizer I'm talking about? Thanks, Eric