From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#38252: 27.0.50; Gnus server definitions and generic function specializers Date: Sun, 17 Nov 2019 21:03:00 -0500 Message-ID: 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="222921"; 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: Eric Abrahamsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 18 03:04:13 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 1iWWOi-000vpo-Pw for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 03:04:13 +0100 Original-Received: from localhost ([::1]:57560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWWOh-0008NI-L7 for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 21:04:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36102) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWWOZ-0008JB-B9 for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 21:04:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWWOY-0004nN-7i for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 21:04:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34165) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWWOY-0004nF-20 for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 21:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWWOX-0002Vf-L0 for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 21:04:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Nov 2019 02:04:01 +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.15740425959590 (code B ref 38252); Mon, 18 Nov 2019 02:04:01 +0000 Original-Received: (at 38252) by debbugs.gnu.org; 18 Nov 2019 02:03:15 +0000 Original-Received: from localhost ([127.0.0.1]:42986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWWNn-0002Ub-4J for submit@debbugs.gnu.org; Sun, 17 Nov 2019 21:03:15 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:30756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWWNj-0002UK-Dl for 38252@debbugs.gnu.org; Sun, 17 Nov 2019 21:03:12 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 07ADD81257; Sun, 17 Nov 2019 21:03:05 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 982238124E; Sun, 17 Nov 2019 21:03:03 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1574042583; bh=5fL2xzBijvRu3b9NgKvL43xHxBWDDK1N86NPOtPeBYM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=OWLJMTA+lc6+FlYyqRyMV7q8Kdbykwu/4bU2URwhCgzGLM8123E9cgyb4k3pgu1wS CN6AVpOvFPBqoIg6yfueK7O3QEGSI9CFYGuXV93OEZyZJ+a6OehCLNEqY4p+6qbFoy rwAGLmAmo1sL9Lmp+f8DQIKSEFE2ahFUlX1LVwqemqsWbFszLlKe02WH149uvwz9gN /9VGHpLRlBjXVoRY598RNTaQ0x11VYRJF87IsqSWsde+4R0ql9Pg1v1OACOCE4L8BQ I9r7BYEc0FnUgHejxRVFNSNrZTcfxJXs393k7lZu/pL0nd67yINzjU3QZo//5IC9vu LZjxbe07uhlDw== Original-Received: from alfajor (unknown [216.154.18.30]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 10580121106; Sun, 17 Nov 2019 21:03:03 -0500 (EST) In-Reply-To: <877e3yb0em.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 17 Nov 2019 14:31:13 -0800") 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:171881 Archived-At: > 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