From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#50834: Feature request: cl-remove-method (prototyped) and buttons for it Date: Fri, 02 Sep 2022 09:29:16 -0400 Message-ID: References: <8735pqq0yb.fsf@gmail.com> <87wnn2nkn6.fsf@gmail.com> <8735daxcxm.fsf@gnus.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28611"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: akater , 50834@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 02 15:35:43 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oU6pi-0007DG-J2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Sep 2022 15:35:42 +0200 Original-Received: from localhost ([::1]:47110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oU6ph-0002iQ-C6 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Sep 2022 09:35:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU6kG-0005b7-Iv for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 09:30:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55606) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oU6kG-0005SN-8a for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 09:30:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oU6kF-0004U5-3R for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 09:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Sep 2022 13:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50834 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 50834-submit@debbugs.gnu.org id=B50834.166212536817150 (code B ref 50834); Fri, 02 Sep 2022 13:30:02 +0000 Original-Received: (at 50834) by debbugs.gnu.org; 2 Sep 2022 13:29:28 +0000 Original-Received: from localhost ([127.0.0.1]:45348 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oU6jg-0004SY-BB for submit@debbugs.gnu.org; Fri, 02 Sep 2022 09:29:28 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34313) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oU6je-0004SL-2P for 50834@debbugs.gnu.org; Fri, 02 Sep 2022 09:29:26 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2D399440FD8; Fri, 2 Sep 2022 09:29:20 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C649D440613; Fri, 2 Sep 2022 09:29:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1662125358; bh=1hPJIbrTi55niLRk407C5IL9tyMQAD3IwwqisZUgTUo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=GZ0jdqsUJsQC/bJoe02CT06HXzenYGHZkuaD1k2Rwq7ht+cBb4yQFMHbcjkRPMrvn bgk5xT89gTipDPJU9pnoqRHaDnBg7eBTxiZk4RA3PW8RgVkHb0+y/rbqLqyKtZYCsx aRF176ZaTUq4LunA34aBs+eTNTT5ubVv5bV9eh4Ij3/VBNrFqcH0wrOTXUaVfIh/3K iBFpadrZ/6moHvfvjHvpFIhUQ9qbciU4ApQ/k5/su26II9aMZsPs03NYucGpckzbJK lwPxtf5f5sX/yUqd78eJ82iHJZexpmRWS7lxdYCK1j7Qy97nINItmpkq+Rv7UEfGNy CTAiVmptF9Fhw== Original-Received: from pastel (unknown [157.52.9.190]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9DFF51200A5; Fri, 2 Sep 2022 09:29:18 -0400 (EDT) In-Reply-To: <8735daxcxm.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 02 Sep 2022 12:56:05 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241346 Archived-At: Lars Ingebrigtsen [2022-09-02 12:56:05] wrote: > akater writes: >> +(cl-defgeneric cl-remove-method (generic-function method) >> + "Remove METHOD from GENERIC-FUNCTION by modifying the >> +GENERIC-FUNCTION (if necessary). > I think this sounds very useful -- I don't think we have any other ways > to remove a method, and that's something that I've been missing > sometimes when implementing stuff. I'd challenge your use of "very", but I agree it's missing. > Perhaps Stefan has some comments here; added to the CCs. Not much to say, except: > + (cl-loop for k being hash-key in cl--generic-combined-method-memoization > + when (and (eq generic-function (car k)) > + (memq method (cdr k))) > + do (remhash k cl--generic-combined-method-memoization)) I don't see why we'd need this. This is a cache that tries to speed up the construction of combined methods, whereas in `cl-remove-method` we should only need to flush the cache that maps tags to their corresponding combined methods and this is done implicitly by `cl--generic-make-function` (which returns a new function with a branch new fresh cache). Stefan